errors: span_suggestion
takes impl ToString
Change `span_suggestion` (and variants) to take `impl ToString` rather than `String` for the suggested code, as this simplifies the requirements on the diagnostic derive. Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
baaa3b6829
commit
73fa217bc1
17 changed files with 40 additions and 40 deletions
|
@ -129,7 +129,7 @@ impl<'tcx> LateLintPass<'tcx> for ArrayIntoIter {
|
|||
diag.span_suggestion(
|
||||
call.ident.span,
|
||||
"use `.iter()` instead of `.into_iter()` to avoid ambiguity",
|
||||
"iter".into(),
|
||||
"iter",
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
if self.for_expr_span == expr.span {
|
||||
|
|
|
@ -738,7 +738,7 @@ pub trait LintContext: Sized {
|
|||
db.span_suggestion_verbose(
|
||||
span.shrink_to_hi(),
|
||||
"insert whitespace here to avoid this being parsed as a prefix in Rust 2021",
|
||||
" ".into(),
|
||||
" ",
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
|
|||
l.span_suggestion_verbose(
|
||||
arg_span.shrink_to_lo(),
|
||||
"add a \"{}\" format string to Display the message",
|
||||
"\"{}\", ".into(),
|
||||
"\"{}\", ",
|
||||
fmt_applicability,
|
||||
);
|
||||
} else if suggest_debug {
|
||||
|
@ -186,7 +186,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
|
|||
"add a \"{{:?}}\" format string to use the Debug implementation of `{}`",
|
||||
ty,
|
||||
),
|
||||
"\"{:?}\", ".into(),
|
||||
"\"{:?}\", ",
|
||||
fmt_applicability,
|
||||
);
|
||||
}
|
||||
|
@ -266,13 +266,13 @@ fn check_panic_str<'tcx>(
|
|||
l.span_suggestion(
|
||||
arg.span.shrink_to_hi(),
|
||||
&format!("add the missing argument{}", pluralize!(n_arguments)),
|
||||
", ...".into(),
|
||||
", ...",
|
||||
Applicability::HasPlaceholders,
|
||||
);
|
||||
l.span_suggestion(
|
||||
arg.span.shrink_to_lo(),
|
||||
"or add a \"{}\" format string to use the message literally",
|
||||
"\"{}\", ".into(),
|
||||
"\"{}\", ",
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ fn check_panic_str<'tcx>(
|
|||
l.span_suggestion(
|
||||
arg.span.shrink_to_lo(),
|
||||
"add a \"{}\" format string to use the message literally",
|
||||
"\"{}\", ".into(),
|
||||
"\"{}\", ",
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue