Remove unneeded calls to format!()
This commit is contained in:
parent
834bc5650a
commit
c1de0b1b70
15 changed files with 34 additions and 53 deletions
|
@ -601,7 +601,7 @@ impl RustcDefaultCalls {
|
||||||
});
|
});
|
||||||
compiler.codegen_backend().link(&sess, Box::new(codegen_results), &outputs)
|
compiler.codegen_backend().link(&sess, Box::new(codegen_results), &outputs)
|
||||||
} else {
|
} else {
|
||||||
sess.fatal(&format!("rlink must be a file"))
|
sess.fatal("rlink must be a file")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1664,10 +1664,9 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let mut err = self.cx.struct_span_err(
|
let mut err = self
|
||||||
it.span(),
|
.cx
|
||||||
&format!("expected path to external documentation"),
|
.struct_span_err(it.span(), "expected path to external documentation");
|
||||||
);
|
|
||||||
|
|
||||||
// Check if the user erroneously used `doc(include(...))` syntax.
|
// Check if the user erroneously used `doc(include(...))` syntax.
|
||||||
let literal = it.meta_item_list().and_then(|list| {
|
let literal = it.meta_item_list().and_then(|list| {
|
||||||
|
|
|
@ -81,10 +81,7 @@ impl AssertModuleSource<'tcx> {
|
||||||
if !self.tcx.sess.opts.debugging_opts.query_dep_graph {
|
if !self.tcx.sess.opts.debugging_opts.query_dep_graph {
|
||||||
self.tcx.sess.span_fatal(
|
self.tcx.sess.span_fatal(
|
||||||
attr.span,
|
attr.span,
|
||||||
&format!(
|
"found CGU-reuse attribute but `-Zquery-dep-graph` was not specified",
|
||||||
"found CGU-reuse attribute but `-Zquery-dep-graph` \
|
|
||||||
was not specified"
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -537,10 +537,7 @@ impl FindAllAttrs<'tcx> {
|
||||||
if !checked_attrs.contains(&attr.id) {
|
if !checked_attrs.contains(&attr.id) {
|
||||||
self.tcx.sess.span_err(
|
self.tcx.sess.span_err(
|
||||||
attr.span,
|
attr.span,
|
||||||
&format!(
|
"found unchecked `#[rustc_dirty]` / `#[rustc_clean]` attribute",
|
||||||
"found unchecked \
|
|
||||||
`#[rustc_dirty]` / `#[rustc_clean]` attribute"
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,10 +39,10 @@ pub struct OverlapResult<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_placeholder_note(err: &mut rustc_errors::DiagnosticBuilder<'_>) {
|
pub fn add_placeholder_note(err: &mut rustc_errors::DiagnosticBuilder<'_>) {
|
||||||
err.note(&format!(
|
err.note(
|
||||||
"this behavior recently changed as a result of a bug fix; \
|
"this behavior recently changed as a result of a bug fix; \
|
||||||
see rust-lang/rust#56105 for details"
|
see rust-lang/rust#56105 for details",
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If there are types that satisfy both impls, invokes `on_overlap`
|
/// If there are types that satisfy both impls, invokes `on_overlap`
|
||||||
|
|
|
@ -935,9 +935,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
// Already reported in the query.
|
// Already reported in the query.
|
||||||
ConstEvalFailure(ErrorHandled::Reported) => {
|
ConstEvalFailure(ErrorHandled::Reported) => {
|
||||||
self.tcx
|
self.tcx.sess.delay_span_bug(span, "constant in type had an ignored error");
|
||||||
.sess
|
|
||||||
.delay_span_bug(span, &format!("constant in type had an ignored error"));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -680,10 +680,7 @@ impl<'a> CrateLoader<'a> {
|
||||||
|
|
||||||
// Sanity check the loaded crate to ensure it is indeed a profiler runtime
|
// Sanity check the loaded crate to ensure it is indeed a profiler runtime
|
||||||
if !data.is_profiler_runtime() {
|
if !data.is_profiler_runtime() {
|
||||||
self.sess.err(&format!(
|
self.sess.err("the crate `profiler_builtins` is not a profiler runtime");
|
||||||
"the crate `profiler_builtins` is not \
|
|
||||||
a profiler runtime"
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,10 +65,8 @@ impl NonConstOp for Downcast {
|
||||||
pub struct FnCallIndirect;
|
pub struct FnCallIndirect;
|
||||||
impl NonConstOp for FnCallIndirect {
|
impl NonConstOp for FnCallIndirect {
|
||||||
fn emit_error(&self, item: &Item<'_, '_>, span: Span) {
|
fn emit_error(&self, item: &Item<'_, '_>, span: Span) {
|
||||||
let mut err = item
|
let mut err =
|
||||||
.tcx
|
item.tcx.sess.struct_span_err(span, "function pointers are not allowed in const fn");
|
||||||
.sess
|
|
||||||
.struct_span_err(span, &format!("function pointers are not allowed in const fn"));
|
|
||||||
err.emit();
|
err.emit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,15 +121,12 @@ impl<'a> Parser<'a> {
|
||||||
.span_label(attrs[0].span, "attributes must go before parameters")
|
.span_label(attrs[0].span, "attributes must go before parameters")
|
||||||
.emit();
|
.emit();
|
||||||
} else {
|
} else {
|
||||||
self.struct_span_err(
|
self.struct_span_err(attrs[0].span, "attribute without generic parameters")
|
||||||
attrs[0].span,
|
.span_label(
|
||||||
&format!("attribute without generic parameters"),
|
attrs[0].span,
|
||||||
)
|
"attributes are only permitted when preceding parameters",
|
||||||
.span_label(
|
)
|
||||||
attrs[0].span,
|
.emit();
|
||||||
"attributes are only permitted when preceding parameters",
|
|
||||||
)
|
|
||||||
.emit();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -64,9 +64,9 @@ fn verify<'tcx>(tcx: TyCtxt<'tcx>, items: &lang_items::LanguageItems) {
|
||||||
for (name, &item) in WEAK_ITEMS_REFS.iter() {
|
for (name, &item) in WEAK_ITEMS_REFS.iter() {
|
||||||
if missing.contains(&item) && !whitelisted(tcx, item) && items.require(item).is_err() {
|
if missing.contains(&item) && !whitelisted(tcx, item) && items.require(item).is_err() {
|
||||||
if item == lang_items::PanicImplLangItem {
|
if item == lang_items::PanicImplLangItem {
|
||||||
tcx.sess.err(&format!("`#[panic_handler]` function required, but not found"));
|
tcx.sess.err("`#[panic_handler]` function required, but not found");
|
||||||
} else if item == lang_items::OomLangItem {
|
} else if item == lang_items::OomLangItem {
|
||||||
tcx.sess.err(&format!("`#[alloc_error_handler]` function required, but not found"));
|
tcx.sess.err("`#[alloc_error_handler]` function required, but not found");
|
||||||
} else {
|
} else {
|
||||||
tcx.sess.err(&format!("language item required, but not found: `{}`", name));
|
tcx.sess.err(&format!("language item required, but not found: `{}`", name));
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,7 @@ impl<'a> Resolver<'a> {
|
||||||
if has_generic_params == HasGenericParams::Yes {
|
if has_generic_params == HasGenericParams::Yes {
|
||||||
// Try to retrieve the span of the function signature and generate a new
|
// Try to retrieve the span of the function signature and generate a new
|
||||||
// message with a local type or const parameter.
|
// message with a local type or const parameter.
|
||||||
let sugg_msg = &format!("try using a local generic parameter instead");
|
let sugg_msg = "try using a local generic parameter instead";
|
||||||
if let Some((sugg_span, snippet)) = sm.generate_local_type_param_snippet(span) {
|
if let Some((sugg_span, snippet)) = sm.generate_local_type_param_snippet(span) {
|
||||||
// Suggest the modification to the user
|
// Suggest the modification to the user
|
||||||
err.span_suggestion(
|
err.span_suggestion(
|
||||||
|
@ -194,7 +194,7 @@ impl<'a> Resolver<'a> {
|
||||||
format!("try adding a local generic parameter in this method instead"),
|
format!("try adding a local generic parameter in this method instead"),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
err.help(&format!("try using a local generic parameter instead"));
|
err.help("try using a local generic parameter instead");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1500,10 +1500,8 @@ fn parse_libs(
|
||||||
{
|
{
|
||||||
early_error(
|
early_error(
|
||||||
error_format,
|
error_format,
|
||||||
&format!(
|
"the library kind 'static-nobundle' is only \
|
||||||
"the library kind 'static-nobundle' is only \
|
accepted on the nightly compiler",
|
||||||
accepted on the nightly compiler"
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let mut name_parts = name.splitn(2, ':');
|
let mut name_parts = name.splitn(2, ':');
|
||||||
|
|
|
@ -888,10 +888,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
err.note(&format!(
|
err.note(
|
||||||
"because of the default `Self` reference, type parameters must be \
|
"because of the default `Self` reference, type parameters must be \
|
||||||
specified on object types"
|
specified on object types",
|
||||||
));
|
);
|
||||||
err.emit();
|
err.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -283,10 +283,10 @@ impl ItemLikeVisitor<'v> for InherentCollect<'tcx> {
|
||||||
"no base type found for inherent implementation"
|
"no base type found for inherent implementation"
|
||||||
)
|
)
|
||||||
.span_label(ty.span, "impl requires a base type")
|
.span_label(ty.span, "impl requires a base type")
|
||||||
.note(&format!(
|
.note(
|
||||||
"either implement a trait on it or create a newtype \
|
"either implement a trait on it or create a newtype \
|
||||||
to wrap it instead"
|
to wrap it instead",
|
||||||
))
|
)
|
||||||
.emit();
|
.emit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1282,10 +1282,10 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::Generics {
|
||||||
param.hir_id,
|
param.hir_id,
|
||||||
param.span,
|
param.span,
|
||||||
|lint| {
|
|lint| {
|
||||||
lint.build(&format!(
|
lint.build(
|
||||||
"defaults for type parameters are only allowed in \
|
"defaults for type parameters are only allowed in \
|
||||||
`struct`, `enum`, `type`, or `trait` definitions."
|
`struct`, `enum`, `type`, or `trait` definitions.",
|
||||||
))
|
)
|
||||||
.emit();
|
.emit();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue