Skip to content

Commit 0897ffc

Browse files
committed
remove _with_applicability from suggestion fns
1 parent 8eaa84c commit 0897ffc

Some content is hidden

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

53 files changed

+315
-418
lines changed

src/librustc/hir/lowering.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1829,7 +1829,7 @@ impl<'a> LoweringContext<'a> {
18291829
if let Ok(snippet) = self.sess.source_map().span_to_snippet(data.span) {
18301830
// Do not suggest going from `Trait()` to `Trait<>`
18311831
if data.inputs.len() > 0 {
1832-
err.span_suggestion_with_applicability(
1832+
err.span_suggestion(
18331833
data.span,
18341834
"use angle brackets instead",
18351835
format!("<{}>", &snippet[1..snippet.len() - 1]),

src/librustc/infer/error_reporting/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
499499
if let Some(ty::error::ExpectedFound { found, .. }) = exp_found {
500500
if ty.is_box() && ty.boxed_ty() == found {
501501
if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) {
502-
err.span_suggestion_with_applicability(
502+
err.span_suggestion(
503503
span,
504504
"consider dereferencing the boxed value",
505505
format!("*{}", snippet),
@@ -532,7 +532,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
532532
err.span_label(then, "expected because of this");
533533
outer.map(|sp| err.span_label(sp, "if and else have incompatible types"));
534534
if let Some(sp) = semicolon {
535-
err.span_suggestion_short_with_applicability(
535+
err.span_suggestion_short(
536536
sp,
537537
"consider removing this semicolon",
538538
String::new(),
@@ -1084,7 +1084,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
10841084
self.tcx.sess.source_map().span_to_snippet(span),
10851085
show_suggestion,
10861086
) {
1087-
diag.span_suggestion_with_applicability(
1087+
diag.span_suggestion(
10881088
span,
10891089
msg,
10901090
format!("{}.as_ref()", snippet),
@@ -1273,7 +1273,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
12731273
let tail = if has_lifetimes { " + " } else { "" };
12741274
format!("{}: {}{}", bound_kind, sub, tail)
12751275
};
1276-
err.span_suggestion_short_with_applicability(
1276+
err.span_suggestion_short(
12771277
sp,
12781278
&consider,
12791279
suggestion,

src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
102102
E0621,
103103
"explicit lifetime required in {}",
104104
error_var
105-
).span_suggestion_with_applicability(
105+
).span_suggestion(
106106
new_ty_span,
107107
&format!("add explicit lifetime `{}` to {}", named, span_label_var),
108108
new_ty.to_string(),

src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
5353
_ => "'_".to_owned(),
5454
};
5555
if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(return_sp) {
56-
err.span_suggestion_with_applicability(
56+
err.span_suggestion(
5757
return_sp,
5858
&format!(
5959
"you can add a constraint to the return type to make it last \

src/librustc/lint/builtin.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ impl BuiltinLintDiagnostics {
473473
Ok(s) => (format!("dyn {}", s), Applicability::MachineApplicable),
474474
Err(_) => ("dyn <type>".to_string(), Applicability::HasPlaceholders)
475475
};
476-
db.span_suggestion_with_applicability(span, "use `dyn`", sugg, app);
476+
db.span_suggestion(span, "use `dyn`", sugg, app);
477477
}
478478
BuiltinLintDiagnostics::AbsPathWithModule(span) => {
479479
let (sugg, app) = match sess.source_map().span_to_snippet(span) {
@@ -490,7 +490,7 @@ impl BuiltinLintDiagnostics {
490490
}
491491
Err(_) => ("crate::<path>".to_string(), Applicability::HasPlaceholders)
492492
};
493-
db.span_suggestion_with_applicability(span, "use `crate`", sugg, app);
493+
db.span_suggestion(span, "use `crate`", sugg, app);
494494
}
495495
BuiltinLintDiagnostics::DuplicatedMacroExports(ident, earlier_span, later_span) => {
496496
db.span_label(later_span, format!("`{}` already exported", ident));
@@ -531,20 +531,15 @@ impl BuiltinLintDiagnostics {
531531
(insertion_span, anon_lts)
532532
}
533533
};
534-
db.span_suggestion_with_applicability(
534+
db.span_suggestion(
535535
replace_span,
536536
&format!("indicate the anonymous lifetime{}", if n >= 2 { "s" } else { "" }),
537537
suggestion,
538538
Applicability::MachineApplicable
539539
);
540540
}
541541
BuiltinLintDiagnostics::UnknownCrateTypes(span, note, sugg) => {
542-
db.span_suggestion_with_applicability(
543-
span,
544-
&note,
545-
sugg,
546-
Applicability::MaybeIncorrect
547-
);
542+
db.span_suggestion(span, &note, sugg, Applicability::MaybeIncorrect);
548543
}
549544
}
550545
}

src/librustc/lint/levels.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ impl<'a> LintLevelsBuilder<'a> {
324324
Some(li.span.into()),
325325
&msg,
326326
);
327-
err.span_suggestion_with_applicability(
327+
err.span_suggestion(
328328
li.span,
329329
"change it to",
330330
new_lint_name.to_string(),
@@ -362,7 +362,7 @@ impl<'a> LintLevelsBuilder<'a> {
362362
Some(li.span.into()),
363363
&msg);
364364
if let Some(new_name) = renamed {
365-
err.span_suggestion_with_applicability(
365+
err.span_suggestion(
366366
li.span,
367367
"use the new name",
368368
new_name,
@@ -386,7 +386,7 @@ impl<'a> LintLevelsBuilder<'a> {
386386
&msg);
387387

388388
if let Some(suggestion) = suggestion {
389-
db.span_suggestion_with_applicability(
389+
db.span_suggestion(
390390
li.span,
391391
"did you mean",
392392
suggestion.to_string(),

src/librustc/middle/liveness.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -1600,12 +1600,16 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
16001600
let mut err = self.ir.tcx
16011601
.struct_span_lint_hir(lint::builtin::UNUSED_VARIABLES, hir_id, sp, &msg);
16021602
if self.ir.variable_is_shorthand(var) {
1603-
err.span_suggestion_with_applicability(sp, "try ignoring the field",
1604-
format!("{}: _", name),
1605-
Applicability::MachineApplicable);
1603+
err.span_suggestion(
1604+
sp,
1605+
"try ignoring the field",
1606+
format!("{}: _", name),
1607+
Applicability::MachineApplicable,
1608+
);
16061609
} else {
1607-
err.span_suggestion_short_with_applicability(
1608-
sp, &suggest_underscore_msg,
1610+
err.span_suggestion_short(
1611+
sp,
1612+
&suggest_underscore_msg,
16091613
format!("_{}", name),
16101614
Applicability::MachineApplicable,
16111615
);

src/librustc/middle/resolve_lifetime.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1526,14 +1526,14 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
15261526
// place ("start at" because the latter includes trailing
15271527
// whitespace), then this is an in-band lifetime
15281528
if decl_span.shrink_to_lo() == use_span.shrink_to_lo() {
1529-
err.span_suggestion_with_applicability(
1529+
err.span_suggestion(
15301530
use_span,
15311531
"elide the single-use lifetime",
15321532
String::new(),
15331533
Applicability::MachineApplicable,
15341534
);
15351535
} else {
1536-
err.multipart_suggestion_with_applicability(
1536+
err.multipart_suggestion(
15371537
"elide the single-use lifetime",
15381538
vec![(decl_span, String::new()), (use_span, String::new())],
15391539
Applicability::MachineApplicable,
@@ -1644,7 +1644,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
16441644
if let Some(generics) = self.tcx.hir().get_generics(parent_def_id) {
16451645
let unused_lt_span = self.lifetime_deletion_span(name, generics);
16461646
if let Some(span) = unused_lt_span {
1647-
err.span_suggestion_with_applicability(
1647+
err.span_suggestion(
16481648
span,
16491649
"elide the unused lifetime",
16501650
String::new(),
@@ -2350,7 +2350,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
23502350
} else {
23512351
(format!("{} + 'static", snippet), Applicability::MaybeIncorrect)
23522352
};
2353-
db.span_suggestion_with_applicability(span, msg, sugg, applicability);
2353+
db.span_suggestion(span, msg, sugg, applicability);
23542354
false
23552355
}
23562356
Err(_) => {

src/librustc/session/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ impl Session {
435435
}
436436
DiagnosticBuilderMethod::SpanSuggestion(suggestion) => {
437437
let span = span_maybe.expect("span_suggestion_* needs a span");
438-
diag_builder.span_suggestion_with_applicability(
438+
diag_builder.span_suggestion(
439439
span,
440440
message,
441441
suggestion,

src/librustc/traits/error_reporting.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
904904
if let Some(ref expr) = local.init {
905905
if let hir::ExprKind::Index(_, _) = expr.node {
906906
if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(expr.span) {
907-
err.span_suggestion_with_applicability(
907+
err.span_suggestion(
908908
expr.span,
909909
"consider borrowing here",
910910
format!("&{}", snippet),
@@ -952,7 +952,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
952952
let format_str = format!("consider removing {} leading `&`-references",
953953
remove_refs);
954954

955-
err.span_suggestion_short_with_applicability(
955+
err.span_suggestion_short(
956956
sp, &format_str, String::new(), Applicability::MachineApplicable
957957
);
958958
break;
@@ -1109,7 +1109,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
11091109
// For example, if `expected_args_length` is 2, suggest `|_, _|`.
11101110
if found_args.is_empty() && is_closure {
11111111
let underscores = vec!["_"; expected_args.len()].join(", ");
1112-
err.span_suggestion_with_applicability(
1112+
err.span_suggestion(
11131113
pipe_span,
11141114
&format!(
11151115
"consider changing the closure to take and ignore the expected argument{}",
@@ -1130,11 +1130,12 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
11301130
.map(|(name, _)| name.to_owned())
11311131
.collect::<Vec<String>>()
11321132
.join(", ");
1133-
err.span_suggestion_with_applicability(found_span,
1134-
"change the closure to take multiple \
1135-
arguments instead of a single tuple",
1136-
format!("|{}|", sugg),
1137-
Applicability::MachineApplicable);
1133+
err.span_suggestion(
1134+
found_span,
1135+
"change the closure to take multiple arguments instead of a single tuple",
1136+
format!("|{}|", sugg),
1137+
Applicability::MachineApplicable,
1138+
);
11381139
}
11391140
}
11401141
if let &[ArgKind::Tuple(_, ref fields)] = &expected_args[..] {
@@ -1162,12 +1163,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
11621163
String::new()
11631164
},
11641165
);
1165-
err.span_suggestion_with_applicability(
1166+
err.span_suggestion(
11661167
found_span,
1167-
"change the closure to accept a tuple instead of \
1168-
individual arguments",
1168+
"change the closure to accept a tuple instead of individual arguments",
11691169
sugg,
1170-
Applicability::MachineApplicable
1170+
Applicability::MachineApplicable,
11711171
);
11721172
}
11731173
}

src/librustc/ty/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
237237
{
238238
if let Ok(snippet) = self.sess.source_map().span_to_snippet(sp) {
239239
if snippet.chars().all(|c| c.is_digit(10) || c == '-' || c == '_') {
240-
db.span_suggestion_with_applicability(
240+
db.span_suggestion(
241241
sp,
242242
"use a float literal",
243243
format!("{}.0", snippet),

src/librustc_borrowck/borrowck/gather_loans/move_error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fn report_move_errors<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, errors: &[MoveErr
7070
let initializer =
7171
e.init.as_ref().expect("should have an initializer to get an error");
7272
if let Ok(snippet) = bccx.tcx.sess.source_map().span_to_snippet(initializer.span) {
73-
err.span_suggestion_with_applicability(
73+
err.span_suggestion(
7474
initializer.span,
7575
"consider using a reference instead",
7676
format!("&{}", snippet),

src/librustc_borrowck/borrowck/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -850,15 +850,15 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
850850
}) = cmt.cat {
851851
db.note(fn_closure_msg);
852852
} else {
853-
db.span_suggestion_with_applicability(
853+
db.span_suggestion(
854854
sp,
855855
msg,
856856
suggestion,
857857
Applicability::Unspecified,
858858
);
859859
}
860860
} else {
861-
db.span_suggestion_with_applicability(
861+
db.span_suggestion(
862862
sp,
863863
msg,
864864
suggestion,
@@ -1229,7 +1229,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
12291229
let let_span = self.tcx.hir().span(node_id);
12301230
let suggestion = suggest_ref_mut(self.tcx, let_span);
12311231
if let Some(replace_str) = suggestion {
1232-
db.span_suggestion_with_applicability(
1232+
db.span_suggestion(
12331233
let_span,
12341234
"use a mutable reference instead",
12351235
replace_str,
@@ -1291,15 +1291,15 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
12911291
)) = ty.map(|t| &t.node)
12921292
{
12931293
let borrow_expr_id = self.tcx.hir().get_parent_node(borrowed_node_id);
1294-
db.span_suggestion_with_applicability(
1294+
db.span_suggestion(
12951295
self.tcx.hir().span(borrow_expr_id),
12961296
"consider removing the `&mut`, as it is an \
12971297
immutable binding to a mutable reference",
12981298
snippet,
12991299
Applicability::MachineApplicable,
13001300
);
13011301
} else {
1302-
db.span_suggestion_with_applicability(
1302+
db.span_suggestion(
13031303
let_span,
13041304
"make this binding mutable",
13051305
format!("mut {}", snippet),
@@ -1326,7 +1326,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
13261326
&cmt_path_or_string,
13271327
capture_span,
13281328
Origin::Ast)
1329-
.span_suggestion_with_applicability(
1329+
.span_suggestion(
13301330
err.span,
13311331
&format!("to force the closure to take ownership of {} \
13321332
(and any other referenced variables), \

src/librustc_borrowck/borrowck/unused.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ impl<'a, 'tcx> UnusedMutCx<'a, 'tcx> {
7878
hir_id,
7979
span,
8080
"variable does not need to be mutable")
81-
.span_suggestion_short_with_applicability(
81+
.span_suggestion_short(
8282
mut_span,
8383
"remove this `mut`",
8484
String::new(),
85-
Applicability::MachineApplicable)
85+
Applicability::MachineApplicable,
86+
)
8687
.emit();
8788
}
8889
}

0 commit comments

Comments
 (0)