remove unnecessary to_string
and String::new
This commit is contained in:
parent
c570ab5a0b
commit
77d6176e69
88 changed files with 292 additions and 340 deletions
|
@ -280,7 +280,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
|||
err.span_suggestion_verbose(
|
||||
expr_span.shrink_to_lo(),
|
||||
"you might have meant to use pattern matching",
|
||||
"let ".to_string(),
|
||||
"let ",
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
|||
err.span_suggestion_short(
|
||||
span,
|
||||
"you might have meant to use `self` here instead",
|
||||
"self".to_string(),
|
||||
"self",
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
if !self.self_value_is_available(path[0].ident.span) {
|
||||
|
@ -317,7 +317,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
|||
span,
|
||||
"if you meant to use `self`, you are also missing a `self` receiver \
|
||||
argument",
|
||||
sugg.to_string(),
|
||||
sugg,
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
|||
err.span_suggestion_verbose(
|
||||
span,
|
||||
"add a `self` receiver parameter to make the associated `fn` a method",
|
||||
sugg.to_string(),
|
||||
sugg,
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
"doesn't"
|
||||
|
@ -612,7 +612,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
|||
err.span_suggestion_short(
|
||||
pat_sp.between(ty_sp),
|
||||
"use `=` if you meant to assign",
|
||||
" = ".to_string(),
|
||||
" = ",
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
}
|
||||
|
@ -642,7 +642,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
|||
err.span_suggestion(
|
||||
span,
|
||||
"use the similarly named label",
|
||||
label_ident.name.to_string(),
|
||||
label_ident.name,
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
// Do not lint against unused label when we suggest them.
|
||||
|
@ -656,7 +656,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
|||
err.span_suggestion(
|
||||
span,
|
||||
"perhaps you intended to use this type",
|
||||
correct.to_string(),
|
||||
correct,
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
}
|
||||
|
@ -687,7 +687,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
|||
err.span_suggestion_verbose(
|
||||
constraint.ident.span.between(trait_ref.span),
|
||||
"you might have meant to write a path instead of an associated type bound",
|
||||
"::".to_string(),
|
||||
"::",
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
|
@ -1079,7 +1079,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
|||
err.span_suggestion_verbose(
|
||||
span.shrink_to_hi(),
|
||||
"use `!` to invoke the macro",
|
||||
"!".to_string(),
|
||||
"!",
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
if path_str == "try" && span.rust_2015() {
|
||||
|
@ -1228,7 +1228,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
|||
err.span_suggestion(
|
||||
span,
|
||||
"use this syntax instead",
|
||||
path_str.to_string(),
|
||||
path_str,
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
}
|
||||
|
@ -1507,7 +1507,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
|||
err.span_suggestion_short(
|
||||
colon_sp,
|
||||
"maybe you meant to write `;` here",
|
||||
";".to_string(),
|
||||
";",
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
} else {
|
||||
|
@ -1518,7 +1518,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
|||
err.span_suggestion(
|
||||
colon_sp,
|
||||
"maybe you meant to write a path separator here",
|
||||
"::".to_string(),
|
||||
"::",
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
show_label = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue