Skip to content

Commit 3a96d6b

Browse files
committed
for file in `fd \.rs$` ; do sed -i s/span_suggestion_with_applicability/span_suggestion/g $file ; done for file in `fd \.rs$` ; do sed -i s/span_suggestion_short_with_applicability/span_suggestion_short/g $file ; done for file in `fd \.rs$` ; do sed -i s/span_suggestions_with_applicability/span_suggestions/g $file ; done
1 parent e9e0a7e commit 3a96d6b

38 files changed

+88
-88
lines changed

clippy_lints/src/assign_ops.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
8383
let r = &sugg::Sugg::hir(cx, rhs, "..");
8484
let long =
8585
format!("{} = {}", snip_a, sugg::make_binop(higher::binop(op.node), a, r));
86-
db.span_suggestion_with_applicability(
86+
db.span_suggestion(
8787
expr.span,
8888
&format!(
8989
"Did you mean {} = {} {} {} or {}? Consider replacing it with",
@@ -96,7 +96,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
9696
format!("{} {}= {}", snip_a, op.node.as_str(), snip_r),
9797
Applicability::MachineApplicable,
9898
);
99-
db.span_suggestion_with_applicability(
99+
db.span_suggestion(
100100
expr.span,
101101
"or",
102102
long,
@@ -183,7 +183,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
183183
if let (Some(snip_a), Some(snip_r)) =
184184
(snippet_opt(cx, assignee.span), snippet_opt(cx, rhs.span))
185185
{
186-
db.span_suggestion_with_applicability(
186+
db.span_suggestion(
187187
expr.span,
188188
"replace it with",
189189
format!("{} {}= {}", snip_a, op.node.as_str(), snip_r),

clippy_lints/src/attrs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
273273
"useless lint attribute",
274274
|db| {
275275
sugg = sugg.replacen("#[", "#![", 1);
276-
db.span_suggestion_with_applicability(
276+
db.span_suggestion(
277277
line_span,
278278
"if you just forgot a `!`, use",
279279
sugg,
@@ -336,7 +336,7 @@ fn check_clippy_lint_names(cx: &LateContext<'_, '_>, items: &[NestedMetaItem]) {
336336
// https://github.com/rust-lang/rust/pull/56992
337337
CheckLintNameResult::NoLint(None) => (),
338338
_ => {
339-
db.span_suggestion_with_applicability(
339+
db.span_suggestion(
340340
lint.span,
341341
"lowercase the lint name",
342342
name_lower,

clippy_lints/src/bit_mask.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BitMask {
142142
"bit mask could be simplified with a call to `trailing_zeros`",
143143
|db| {
144144
let sugg = Sugg::hir(cx, left1, "...").maybe_par();
145-
db.span_suggestion_with_applicability(
145+
db.span_suggestion(
146146
e.span,
147147
"try",
148148
format!("{}.trailing_zeros() >= {}", sugg, n.count_ones()),

clippy_lints/src/booleans.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ impl<'a, 'tcx> NonminimalBoolVisitor<'a, 'tcx> {
393393
"this expression can be optimized out by applying boolean operations to the \
394394
outer expression",
395395
);
396-
db.span_suggestion_with_applicability(
396+
db.span_suggestion(
397397
e.span,
398398
"it would look like the following",
399399
suggest(self.cx, suggestion, &h2q.terminals).0,
@@ -423,7 +423,7 @@ impl<'a, 'tcx> NonminimalBoolVisitor<'a, 'tcx> {
423423
e.span,
424424
"this boolean expression can be simplified",
425425
|db| {
426-
db.span_suggestions_with_applicability(
426+
db.span_suggestions(
427427
e.span,
428428
"try",
429429
suggestions.into_iter(),

clippy_lints/src/collapsible_if.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ fn check_collapsible_no_if_let(cx: &EarlyContext<'_>, expr: &ast::Expr, check: &
154154
span_lint_and_then(cx, COLLAPSIBLE_IF, expr.span, "this if statement can be collapsed", |db| {
155155
let lhs = Sugg::ast(cx, check, "..");
156156
let rhs = Sugg::ast(cx, check_inner, "..");
157-
db.span_suggestion_with_applicability(
157+
db.span_suggestion(
158158
expr.span,
159159
"try",
160160
format!(

clippy_lints/src/const_static_lifetime.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl StaticConst {
6666
lifetime.ident.span,
6767
"Constants have by default a `'static` lifetime",
6868
|db| {
69-
db.span_suggestion_with_applicability(
69+
db.span_suggestion(
7070
ty.span,
7171
"consider removing `'static`",
7272
sugg,

clippy_lints/src/copies.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ fn lint_match_arms(cx: &LateContext<'_, '_>, expr: &Expr) {
207207
|db| {
208208
db.span_note(i.body.span, "same as this");
209209

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

clippy_lints/src/entry.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl<'a, 'tcx, 'b> Visitor<'tcx> for InsertVisitor<'a, 'tcx, 'b> {
149149
snippet(self.cx, params[1].span, ".."),
150150
snippet(self.cx, params[2].span, ".."));
151151

152-
db.span_suggestion_with_applicability(
152+
db.span_suggestion(
153153
self.span,
154154
"consider using",
155155
help,
@@ -161,7 +161,7 @@ impl<'a, 'tcx, 'b> Visitor<'tcx> for InsertVisitor<'a, 'tcx, 'b> {
161161
snippet(self.cx, self.map.span, "map"),
162162
snippet(self.cx, params[1].span, ".."));
163163

164-
db.span_suggestion_with_applicability(
164+
db.span_suggestion(
165165
self.span,
166166
"consider using",
167167
help,

clippy_lints/src/eq_op.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
126126
{
127127
span_lint_and_then(cx, OP_REF, e.span, "needlessly taken reference of left operand", |db| {
128128
let lsnip = snippet(cx, l.span, "...").to_string();
129-
db.span_suggestion_with_applicability(
129+
db.span_suggestion(
130130
left.span,
131131
"use the left value directly",
132132
lsnip,
@@ -144,7 +144,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
144144
"needlessly taken reference of right operand",
145145
|db| {
146146
let rsnip = snippet(cx, r.span, "...").to_string();
147-
db.span_suggestion_with_applicability(
147+
db.span_suggestion(
148148
right.span,
149149
"use the right value directly",
150150
rsnip,
@@ -163,7 +163,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
163163
{
164164
span_lint_and_then(cx, OP_REF, e.span, "needlessly taken reference of left operand", |db| {
165165
let lsnip = snippet(cx, l.span, "...").to_string();
166-
db.span_suggestion_with_applicability(
166+
db.span_suggestion(
167167
left.span,
168168
"use the left value directly",
169169
lsnip,
@@ -181,7 +181,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
181181
{
182182
span_lint_and_then(cx, OP_REF, e.span, "taken reference of right operand", |db| {
183183
let rsnip = snippet(cx, r.span, "...").to_string();
184-
db.span_suggestion_with_applicability(
184+
db.span_suggestion(
185185
right.span,
186186
"use the right value directly",
187187
rsnip,

clippy_lints/src/eta_reduction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ fn check_closure(cx: &LateContext<'_, '_>, expr: &Expr) {
101101
}
102102
span_lint_and_then(cx, REDUNDANT_CLOSURE, expr.span, "redundant closure found", |db| {
103103
if let Some(snippet) = snippet_opt(cx, caller.span) {
104-
db.span_suggestion_with_applicability(
104+
db.span_suggestion(
105105
expr.span,
106106
"remove closure as shown",
107107
snippet,

clippy_lints/src/format.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
8383
};
8484

8585
span_lint_and_then(cx, USELESS_FORMAT, span, "useless use of `format!`", |db| {
86-
db.span_suggestion_with_applicability(
86+
db.span_suggestion(
8787
expr.span,
8888
message,
8989
sugg,
@@ -99,7 +99,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
9999
if tup.is_empty() {
100100
let sugg = format!("{}.to_string()", snippet(cx, expr.span, "<expr>").into_owned());
101101
span_lint_and_then(cx, USELESS_FORMAT, span, "useless use of `format!`", |db| {
102-
db.span_suggestion_with_applicability(
102+
db.span_suggestion(
103103
span,
104104
"consider using .to_string()",
105105
sugg,

clippy_lints/src/identity_conversion.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IdentityConversion {
7171
let sugg = snippet_with_macro_callsite(cx, args[0].span, "<expr>").to_string();
7272

7373
span_lint_and_then(cx, IDENTITY_CONVERSION, e.span, "identical conversion", |db| {
74-
db.span_suggestion_with_applicability(
74+
db.span_suggestion(
7575
e.span,
7676
"consider removing `.into()`",
7777
sugg,
@@ -86,7 +86,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IdentityConversion {
8686
if same_tys(cx, a, b) {
8787
let sugg = snippet(cx, args[0].span, "<expr>").into_owned();
8888
span_lint_and_then(cx, IDENTITY_CONVERSION, e.span, "identical conversion", |db| {
89-
db.span_suggestion_with_applicability(
89+
db.span_suggestion(
9090
e.span,
9191
"consider removing `.into_iter()`",
9292
sugg,
@@ -108,7 +108,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IdentityConversion {
108108
let sugg_msg =
109109
format!("consider removing `{}()`", snippet(cx, path.span, "From::from"));
110110
span_lint_and_then(cx, IDENTITY_CONVERSION, e.span, "identical conversion", |db| {
111-
db.span_suggestion_with_applicability(
111+
db.span_suggestion(
112112
e.span,
113113
&sugg_msg,
114114
sugg,

clippy_lints/src/implicit_return.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl Pass {
3939
fn lint(cx: &LateContext<'_, '_>, outer_span: syntax_pos::Span, inner_span: syntax_pos::Span, msg: &str) {
4040
span_lint_and_then(cx, IMPLICIT_RETURN, outer_span, "missing return statement", |db| {
4141
if let Some(snippet) = snippet_opt(cx, inner_span) {
42-
db.span_suggestion_with_applicability(
42+
db.span_suggestion(
4343
outer_span,
4444
msg,
4545
format!("return {}", snippet),

clippy_lints/src/int_plus_one.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl IntPlusOne {
162162
block.span,
163163
"Unnecessary `>= y + 1` or `x - 1 >=`",
164164
|db| {
165-
db.span_suggestion_with_applicability(
165+
db.span_suggestion(
166166
block.span,
167167
"change `>= y + 1` to `> y` as shown",
168168
recommendation,

clippy_lints/src/large_enum_variant.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LargeEnumVariant {
100100
VariantData::Unit(_) => unreachable!(),
101101
};
102102
if let Some(snip) = snippet_opt(cx, span) {
103-
db.span_suggestion_with_applicability(
103+
db.span_suggestion(
104104
span,
105105
"consider boxing the large fields to reduce the total size of the \
106106
enum",

clippy_lints/src/let_if_seq.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetIfSeq {
124124
span,
125125
"`if _ { .. } else { .. }` is an expression",
126126
|db| {
127-
db.span_suggestion_with_applicability(
127+
db.span_suggestion(
128128
span,
129129
"it is more idiomatic to write",
130130
sug,

clippy_lints/src/loops.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1304,7 +1304,7 @@ fn check_for_loop_reverse_range<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, arg: &'tcx
13041304
expr.span,
13051305
"this range is empty so this for loop will never run",
13061306
|db| {
1307-
db.span_suggestion_with_applicability(
1307+
db.span_suggestion(
13081308
arg.span,
13091309
"consider using the following if you are attempting to iterate over this \
13101310
range in reverse",
@@ -2408,7 +2408,7 @@ fn check_needless_collect<'a, 'tcx>(expr: &'tcx Expr, cx: &LateContext<'a, 'tcx>
24082408
if method.ident.name == "len" {
24092409
let span = shorten_needless_collect_span(expr);
24102410
span_lint_and_then(cx, NEEDLESS_COLLECT, span, NEEDLESS_COLLECT_MSG, |db| {
2411-
db.span_suggestion_with_applicability(
2411+
db.span_suggestion(
24122412
span,
24132413
"replace with",
24142414
".count()".to_string(),
@@ -2419,7 +2419,7 @@ fn check_needless_collect<'a, 'tcx>(expr: &'tcx Expr, cx: &LateContext<'a, 'tcx>
24192419
if method.ident.name == "is_empty" {
24202420
let span = shorten_needless_collect_span(expr);
24212421
span_lint_and_then(cx, NEEDLESS_COLLECT, span, NEEDLESS_COLLECT_MSG, |db| {
2422-
db.span_suggestion_with_applicability(
2422+
db.span_suggestion(
24232423
span,
24242424
"replace with",
24252425
".next().is_none()".to_string(),
@@ -2431,7 +2431,7 @@ fn check_needless_collect<'a, 'tcx>(expr: &'tcx Expr, cx: &LateContext<'a, 'tcx>
24312431
let contains_arg = snippet(cx, args[1].span, "??");
24322432
let span = shorten_needless_collect_span(expr);
24332433
span_lint_and_then(cx, NEEDLESS_COLLECT, span, NEEDLESS_COLLECT_MSG, |db| {
2434-
db.span_suggestion_with_applicability(
2434+
db.span_suggestion(
24352435
span,
24362436
"replace with",
24372437
format!(

clippy_lints/src/map_unit_fn.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ fn lint_map_unit_fn(cx: &LateContext<'_, '_>, stmt: &hir::Stmt, expr: &hir::Expr
216216
);
217217

218218
span_lint_and_then(cx, lint, expr.span, &msg, |db| {
219-
db.span_suggestion_with_applicability(stmt.span, "try this", suggestion, Applicability::Unspecified);
219+
db.span_suggestion(stmt.span, "try this", suggestion, Applicability::Unspecified);
220220
});
221221
} else if let Some((binding, closure_expr)) = unit_closure(cx, fn_arg) {
222222
let msg = suggestion_msg("closure", map_type);
@@ -230,7 +230,7 @@ fn lint_map_unit_fn(cx: &LateContext<'_, '_>, stmt: &hir::Stmt, expr: &hir::Expr
230230
snippet(cx, var_arg.span, "_"),
231231
snippet(cx, reduced_expr_span, "_")
232232
);
233-
db.span_suggestion_with_applicability(
233+
db.span_suggestion(
234234
stmt.span,
235235
"try this",
236236
suggestion,
@@ -243,7 +243,7 @@ fn lint_map_unit_fn(cx: &LateContext<'_, '_>, stmt: &hir::Stmt, expr: &hir::Expr
243243
snippet(cx, binding.pat.span, "_"),
244244
snippet(cx, var_arg.span, "_")
245245
);
246-
db.span_suggestion_with_applicability(stmt.span, "try this", suggestion, Applicability::Unspecified);
246+
db.span_suggestion(stmt.span, "try this", suggestion, Applicability::Unspecified);
247247
}
248248
});
249249
}

clippy_lints/src/matches.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ fn check_match_bool(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm], expr: &Ex
375375
};
376376

377377
if let Some(sugg) = sugg {
378-
db.span_suggestion_with_applicability(
378+
db.span_suggestion(
379379
expr.span,
380380
"consider using an if/else expression",
381381
sugg,

clippy_lints/src/mem_discriminant.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MemDiscriminant {
7474
}
7575

7676
let derefs: String = iter::repeat('*').take(derefs_needed).collect();
77-
db.span_suggestion_with_applicability(
77+
db.span_suggestion(
7878
param.span,
7979
"try dereferencing",
8080
format!("{}{}", derefs, snippet(cx, cur_expr.span, "<param>")),

0 commit comments

Comments
 (0)