1
Fork 0

remove unnecessary to_string and String::new

This commit is contained in:
Takayuki Maeda 2022-06-13 15:48:40 +09:00
parent c570ab5a0b
commit 77d6176e69
88 changed files with 292 additions and 340 deletions

View file

@ -1194,7 +1194,7 @@ pub fn expr_to_spanned_string<'a>(
err.span_suggestion(
expr.span.shrink_to_lo(),
"consider removing the leading `b`",
String::new(),
"",
Applicability::MaybeIncorrect,
);
Some((err, true))

View file

@ -945,7 +945,7 @@ pub fn ensure_complete_parse<'a>(
err.span_suggestion(
semi_span,
"you might be missing a semicolon here",
";".to_owned(),
";",
Applicability::MaybeIncorrect,
);
}

View file

@ -102,7 +102,7 @@ fn emit_frag_parse_err(
e.span_suggestion_verbose(
site_span.shrink_to_hi(),
"add `;` to interpret the expansion as a statement",
";".to_string(),
";",
Applicability::MaybeIncorrect,
);
}
@ -357,7 +357,7 @@ fn expand_macro<'cx>(
err.span_suggestion_short(
comma_span,
"missing comma here",
", ".to_string(),
", ",
Applicability::MachineApplicable,
);
}

View file

@ -52,7 +52,7 @@ impl MetaVarExpr {
err.span_suggestion(
ident.span,
"supported expressions are count, ignore, index and length",
String::new(),
"",
Applicability::MachineApplicable,
);
return Err(err);
@ -142,7 +142,7 @@ fn parse_ident<'sess>(
err.span_suggestion(
token.span,
&format!("try removing `{}`", &token_str),
String::new(),
"",
Applicability::MaybeIncorrect,
);
return Err(err);