Skip to content

Commit 13421e3

Browse files
committed
Auto merge of #3705 - matthiaskrgr:rustup, r=phansch
rustup rustup rust-lang/rust#57907 and rust-lang/rust#57726 Fixes #3708
2 parents e3270c6 + 16c0a2f commit 13421e3

File tree

133 files changed

+696
-109
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+696
-109
lines changed

clippy_lints/src/approx_const.rs

+4
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ impl LintPass for Pass {
6060
fn get_lints(&self) -> LintArray {
6161
lint_array!(APPROX_CONSTANT)
6262
}
63+
64+
fn name(&self) -> &'static str {
65+
"ApproxConstant"
66+
}
6367
}
6468

6569
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {

clippy_lints/src/arithmetic.rs

+4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ impl LintPass for Arithmetic {
5252
fn get_lints(&self) -> LintArray {
5353
lint_array!(INTEGER_ARITHMETIC, FLOAT_ARITHMETIC)
5454
}
55+
56+
fn name(&self) -> &'static str {
57+
"Arithmetic"
58+
}
5559
}
5660

5761
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Arithmetic {

clippy_lints/src/assertions_on_constants.rs

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ impl LintPass for AssertionsOnConstants {
3434
fn get_lints(&self) -> LintArray {
3535
lint_array![ASSERTIONS_ON_CONSTANTS]
3636
}
37+
38+
fn name(&self) -> &'static str {
39+
"AssertionsOnConstants"
40+
}
3741
}
3842

3943
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssertionsOnConstants {

clippy_lints/src/assign_ops.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ impl LintPass for AssignOps {
5757
fn get_lints(&self) -> LintArray {
5858
lint_array!(ASSIGN_OP_PATTERN, MISREFACTORED_ASSIGN_OP)
5959
}
60+
61+
fn name(&self) -> &'static str {
62+
"AssignOps"
63+
}
6064
}
6165

6266
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
@@ -79,7 +83,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
7983
let r = &sugg::Sugg::hir(cx, rhs, "..");
8084
let long =
8185
format!("{} = {}", snip_a, sugg::make_binop(higher::binop(op.node), a, r));
82-
db.span_suggestion_with_applicability(
86+
db.span_suggestion(
8387
expr.span,
8488
&format!(
8589
"Did you mean {} = {} {} {} or {}? Consider replacing it with",
@@ -92,7 +96,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
9296
format!("{} {}= {}", snip_a, op.node.as_str(), snip_r),
9397
Applicability::MachineApplicable,
9498
);
95-
db.span_suggestion_with_applicability(
99+
db.span_suggestion(
96100
expr.span,
97101
"or",
98102
long,
@@ -179,7 +183,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
179183
if let (Some(snip_a), Some(snip_r)) =
180184
(snippet_opt(cx, assignee.span), snippet_opt(cx, rhs.span))
181185
{
182-
db.span_suggestion_with_applicability(
186+
db.span_suggestion(
183187
expr.span,
184188
"replace it with",
185189
format!("{} {}= {}", snip_a, op.node.as_str(), snip_r),

clippy_lints/src/attrs.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ impl LintPass for AttrPass {
199199
UNKNOWN_CLIPPY_LINTS,
200200
)
201201
}
202+
203+
fn name(&self) -> &'static str {
204+
"Attributes"
205+
}
202206
}
203207

204208
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
@@ -269,7 +273,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
269273
"useless lint attribute",
270274
|db| {
271275
sugg = sugg.replacen("#[", "#![", 1);
272-
db.span_suggestion_with_applicability(
276+
db.span_suggestion(
273277
line_span,
274278
"if you just forgot a `!`, use",
275279
sugg,
@@ -332,7 +336,7 @@ fn check_clippy_lint_names(cx: &LateContext<'_, '_>, items: &[NestedMetaItem]) {
332336
// https://github.com/rust-lang/rust/pull/56992
333337
CheckLintNameResult::NoLint(None) => (),
334338
_ => {
335-
db.span_suggestion_with_applicability(
339+
db.span_suggestion(
336340
lint.span,
337341
"lowercase the lint name",
338342
name_lower,
@@ -500,6 +504,10 @@ impl LintPass for CfgAttrPass {
500504
fn get_lints(&self) -> LintArray {
501505
lint_array!(DEPRECATED_CFG_ATTR,)
502506
}
507+
508+
fn name(&self) -> &'static str {
509+
"DeprecatedCfgAttribute"
510+
}
503511
}
504512

505513
impl EarlyLintPass for CfgAttrPass {

clippy_lints/src/bit_mask.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ impl LintPass for BitMask {
108108
fn get_lints(&self) -> LintArray {
109109
lint_array!(BAD_BIT_MASK, INEFFECTIVE_BIT_MASK, VERBOSE_BIT_MASK)
110110
}
111+
fn name(&self) -> &'static str {
112+
"BitMask"
113+
}
111114
}
112115

113116
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BitMask {
@@ -139,7 +142,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BitMask {
139142
"bit mask could be simplified with a call to `trailing_zeros`",
140143
|db| {
141144
let sugg = Sugg::hir(cx, left1, "...").maybe_par();
142-
db.span_suggestion_with_applicability(
145+
db.span_suggestion(
143146
e.span,
144147
"try",
145148
format!("{}.trailing_zeros() >= {}", sugg, n.count_ones()),

clippy_lints/src/blacklisted_name.rs

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ impl LintPass for BlackListedName {
3737
fn get_lints(&self) -> LintArray {
3838
lint_array!(BLACKLISTED_NAME)
3939
}
40+
fn name(&self) -> &'static str {
41+
"BlacklistedName"
42+
}
4043
}
4144

4245
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlackListedName {

clippy_lints/src/block_in_if_condition.rs

+4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ impl LintPass for BlockInIfCondition {
4949
fn get_lints(&self) -> LintArray {
5050
lint_array!(BLOCK_IN_IF_CONDITION_EXPR, BLOCK_IN_IF_CONDITION_STMT)
5151
}
52+
53+
fn name(&self) -> &'static str {
54+
"BlockInIfCondition"
55+
}
5256
}
5357

5458
struct ExVisitor<'a, 'tcx: 'a> {

clippy_lints/src/booleans.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ impl LintPass for NonminimalBool {
5858
fn get_lints(&self) -> LintArray {
5959
lint_array!(NONMINIMAL_BOOL, LOGIC_BUG)
6060
}
61+
62+
fn name(&self) -> &'static str {
63+
"NonminimalBool"
64+
}
6165
}
6266

6367
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonminimalBool {
@@ -389,7 +393,7 @@ impl<'a, 'tcx> NonminimalBoolVisitor<'a, 'tcx> {
389393
"this expression can be optimized out by applying boolean operations to the \
390394
outer expression",
391395
);
392-
db.span_suggestion_with_applicability(
396+
db.span_suggestion(
393397
e.span,
394398
"it would look like the following",
395399
suggest(self.cx, suggestion, &h2q.terminals).0,
@@ -419,7 +423,7 @@ impl<'a, 'tcx> NonminimalBoolVisitor<'a, 'tcx> {
419423
e.span,
420424
"this boolean expression can be simplified",
421425
|db| {
422-
db.span_suggestions_with_applicability(
426+
db.span_suggestions(
423427
e.span,
424428
"try",
425429
suggestions.into_iter(),

clippy_lints/src/bytecount.rs

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ impl LintPass for ByteCount {
3838
fn get_lints(&self) -> LintArray {
3939
lint_array!(NAIVE_BYTECOUNT)
4040
}
41+
42+
fn name(&self) -> &'static str {
43+
"ByteCount"
44+
}
4145
}
4246

4347
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ByteCount {

clippy_lints/src/cargo_common_metadata.rs

+4
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ impl LintPass for Pass {
6262
fn get_lints(&self) -> LintArray {
6363
lint_array!(CARGO_COMMON_METADATA)
6464
}
65+
66+
fn name(&self) -> &'static str {
67+
"CargoCommonMetadata"
68+
}
6569
}
6670

6771
impl EarlyLintPass for Pass {

clippy_lints/src/collapsible_if.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ impl LintPass for CollapsibleIf {
7878
fn get_lints(&self) -> LintArray {
7979
lint_array!(COLLAPSIBLE_IF)
8080
}
81+
82+
fn name(&self) -> &'static str {
83+
"CollapsibleIf"
84+
}
8185
}
8286

8387
impl EarlyLintPass for CollapsibleIf {
@@ -150,7 +154,7 @@ fn check_collapsible_no_if_let(cx: &EarlyContext<'_>, expr: &ast::Expr, check: &
150154
span_lint_and_then(cx, COLLAPSIBLE_IF, expr.span, "this if statement can be collapsed", |db| {
151155
let lhs = Sugg::ast(cx, check, "..");
152156
let rhs = Sugg::ast(cx, check_inner, "..");
153-
db.span_suggestion_with_applicability(
157+
db.span_suggestion(
154158
expr.span,
155159
"try",
156160
format!(

clippy_lints/src/const_static_lifetime.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ impl LintPass for StaticConst {
3232
fn get_lints(&self) -> LintArray {
3333
lint_array!(CONST_STATIC_LIFETIME)
3434
}
35+
36+
fn name(&self) -> &'static str {
37+
"StaticConst"
38+
}
3539
}
3640

3741
impl StaticConst {
@@ -62,7 +66,7 @@ impl StaticConst {
6266
lifetime.ident.span,
6367
"Constants have by default a `'static` lifetime",
6468
|db| {
65-
db.span_suggestion_with_applicability(
69+
db.span_suggestion(
6670
ty.span,
6771
"consider removing `'static`",
6872
sugg,

clippy_lints/src/copies.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ impl LintPass for CopyAndPaste {
110110
fn get_lints(&self) -> LintArray {
111111
lint_array![IFS_SAME_COND, IF_SAME_THEN_ELSE, MATCH_SAME_ARMS]
112112
}
113+
114+
fn name(&self) -> &'static str {
115+
"CopyAndPaste"
116+
}
113117
}
114118

115119
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CopyAndPaste {
@@ -203,7 +207,7 @@ fn lint_match_arms(cx: &LateContext<'_, '_>, expr: &Expr) {
203207
|db| {
204208
db.span_note(i.body.span, "same as this");
205209

206-
// Note: this does not use `span_suggestion_with_applicability` on purpose:
210+
// Note: this does not use `span_suggestion` on purpose:
207211
// there is no clean way
208212
// to remove the other arm. Building a span and suggest to replace it to ""
209213
// makes an even more confusing error message. Also in order not to make up a

clippy_lints/src/copy_iterator.rs

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ impl LintPass for CopyIterator {
3535
fn get_lints(&self) -> LintArray {
3636
lint_array![COPY_ITERATOR]
3737
}
38+
39+
fn name(&self) -> &'static str {
40+
"CopyIterator"
41+
}
3842
}
3943

4044
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CopyIterator {

clippy_lints/src/cyclomatic_complexity.rs

+4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ impl LintPass for CyclomaticComplexity {
4242
fn get_lints(&self) -> LintArray {
4343
lint_array!(CYCLOMATIC_COMPLEXITY)
4444
}
45+
46+
fn name(&self) -> &'static str {
47+
"CyclomaticComplexity"
48+
}
4549
}
4650

4751
impl CyclomaticComplexity {

clippy_lints/src/default_trait_access.rs

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ impl LintPass for DefaultTraitAccess {
3535
fn get_lints(&self) -> LintArray {
3636
lint_array!(DEFAULT_TRAIT_ACCESS)
3737
}
38+
39+
fn name(&self) -> &'static str {
40+
"DefaultTraitAccess"
41+
}
3842
}
3943

4044
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DefaultTraitAccess {

clippy_lints/src/derive.rs

+4
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ impl LintPass for Derive {
6868
fn get_lints(&self) -> LintArray {
6969
lint_array!(EXPL_IMPL_CLONE_ON_COPY, DERIVE_HASH_XOR_EQ)
7070
}
71+
72+
fn name(&self) -> &'static str {
73+
"Derive"
74+
}
7175
}
7276

7377
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Derive {

clippy_lints/src/doc.rs

+4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ impl LintPass for Doc {
4848
fn get_lints(&self) -> LintArray {
4949
lint_array![DOC_MARKDOWN]
5050
}
51+
52+
fn name(&self) -> &'static str {
53+
"DocMarkdown"
54+
}
5155
}
5256

5357
impl EarlyLintPass for Doc {

clippy_lints/src/double_comparison.rs

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ impl LintPass for Pass {
3737
fn get_lints(&self) -> LintArray {
3838
lint_array!(DOUBLE_COMPARISONS)
3939
}
40+
41+
fn name(&self) -> &'static str {
42+
"DoubleComparisons"
43+
}
4044
}
4145

4246
impl<'a, 'tcx> Pass {

clippy_lints/src/double_parens.rs

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ impl LintPass for DoubleParens {
2929
fn get_lints(&self) -> LintArray {
3030
lint_array!(DOUBLE_PARENS)
3131
}
32+
33+
fn name(&self) -> &'static str {
34+
"DoubleParens"
35+
}
3236
}
3337

3438
impl EarlyLintPass for DoubleParens {

clippy_lints/src/drop_forget_ref.rs

+4
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ impl LintPass for Pass {
112112
fn get_lints(&self) -> LintArray {
113113
lint_array!(DROP_REF, FORGET_REF, DROP_COPY, FORGET_COPY)
114114
}
115+
116+
fn name(&self) -> &'static str {
117+
"DropForgetRef"
118+
}
115119
}
116120

117121
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {

clippy_lints/src/duration_subsec.rs

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ impl LintPass for DurationSubsec {
3636
fn get_lints(&self) -> LintArray {
3737
lint_array!(DURATION_SUBSEC)
3838
}
39+
40+
fn name(&self) -> &'static str {
41+
"DurationSubsec"
42+
}
3943
}
4044

4145
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DurationSubsec {

clippy_lints/src/else_if_without_else.rs

+4
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ impl LintPass for ElseIfWithoutElse {
4646
fn get_lints(&self) -> LintArray {
4747
lint_array!(ELSE_IF_WITHOUT_ELSE)
4848
}
49+
50+
fn name(&self) -> &'static str {
51+
"ElseIfWithoutElse"
52+
}
4953
}
5054

5155
impl EarlyLintPass for ElseIfWithoutElse {

clippy_lints/src/empty_enum.rs

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ impl LintPass for EmptyEnum {
3030
fn get_lints(&self) -> LintArray {
3131
lint_array!(EMPTY_ENUM)
3232
}
33+
34+
fn name(&self) -> &'static str {
35+
"EmptyEnum"
36+
}
3337
}
3438

3539
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EmptyEnum {

0 commit comments

Comments
 (0)