Rollup merge of #105873 - matthiaskrgr:clippy_fmt, r=Nilstrieb

use &str / String literals instead of format!()
This commit is contained in:
Matthias Krüger 2022-12-18 23:03:07 +01:00 committed by GitHub
commit ebe3563764
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 37 additions and 55 deletions

View file

@ -184,7 +184,7 @@ fn msg_span_from_early_bound_and_free_regions<'tcx>(
let text = if br.has_name() {
format!("the lifetime `{}` as defined here", br.name)
} else {
format!("the anonymous lifetime as defined here")
"the anonymous lifetime as defined here".to_string()
};
(text, sp)
}
@ -203,7 +203,7 @@ fn msg_span_from_early_bound_and_free_regions<'tcx>(
sp = param.span;
}
let text = if name == kw::UnderscoreLifetime {
format!("the anonymous lifetime as defined here")
"the anonymous lifetime as defined here".to_string()
} else {
format!("the lifetime `{}` as defined here", name)
};

View file

@ -44,7 +44,7 @@ impl<'tcx> NiceRegionError<'_, 'tcx> {
);
}
(Some(sub_span), Some(sup_span), _, Some(sup_symbol)) => {
err.span_note(sub_span, format!("the lifetime defined here..."));
err.span_note(sub_span, "the lifetime defined here...");
err.span_note(
sup_span,
format!("...must outlive the lifetime `{sup_symbol}` defined here"),
@ -55,17 +55,11 @@ impl<'tcx> NiceRegionError<'_, 'tcx> {
sub_span,
format!("the lifetime `{sub_symbol}` defined here..."),
);
err.span_note(
sup_span,
format!("...must outlive the lifetime defined here"),
);
err.span_note(sup_span, "...must outlive the lifetime defined here");
}
(Some(sub_span), Some(sup_span), _, _) => {
err.span_note(sub_span, format!("the lifetime defined here..."));
err.span_note(
sup_span,
format!("...must outlive the lifetime defined here"),
);
err.span_note(sub_span, "the lifetime defined here...");
err.span_note(sup_span, "...must outlive the lifetime defined here");
}
_ => {}
}