Skip to content

Commit 61b091b

Browse files
authored
Rollup merge of #69541 - dotdash:format, r=Mark-Simulacrum
Remove unneeded calls to format!()
2 parents b95945c + c1de0b1 commit 61b091b

File tree

15 files changed

+34
-53
lines changed

15 files changed

+34
-53
lines changed

src/librustc_driver/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ impl RustcDefaultCalls {
601601
});
602602
compiler.codegen_backend().link(&sess, Box::new(codegen_results), &outputs)
603603
} else {
604-
sess.fatal(&format!("rlink must be a file"))
604+
sess.fatal("rlink must be a file")
605605
}
606606
}
607607

src/librustc_expand/expand.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,10 +1668,9 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
16681668
}
16691669
}
16701670
} else {
1671-
let mut err = self.cx.struct_span_err(
1672-
it.span(),
1673-
&format!("expected path to external documentation"),
1674-
);
1671+
let mut err = self
1672+
.cx
1673+
.struct_span_err(it.span(), "expected path to external documentation");
16751674

16761675
// Check if the user erroneously used `doc(include(...))` syntax.
16771676
let literal = it.meta_item_list().and_then(|list| {

src/librustc_incremental/assert_module_sources.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,7 @@ impl AssertModuleSource<'tcx> {
8181
if !self.tcx.sess.opts.debugging_opts.query_dep_graph {
8282
self.tcx.sess.span_fatal(
8383
attr.span,
84-
&format!(
85-
"found CGU-reuse attribute but `-Zquery-dep-graph` \
86-
was not specified"
87-
),
84+
"found CGU-reuse attribute but `-Zquery-dep-graph` was not specified",
8885
);
8986
}
9087

src/librustc_incremental/persist/dirty_clean.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,10 +537,7 @@ impl FindAllAttrs<'tcx> {
537537
if !checked_attrs.contains(&attr.id) {
538538
self.tcx.sess.span_err(
539539
attr.span,
540-
&format!(
541-
"found unchecked \
542-
`#[rustc_dirty]` / `#[rustc_clean]` attribute"
543-
),
540+
"found unchecked `#[rustc_dirty]` / `#[rustc_clean]` attribute",
544541
);
545542
}
546543
}

src/librustc_infer/traits/coherence.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ pub struct OverlapResult<'tcx> {
3939
}
4040

4141
pub fn add_placeholder_note(err: &mut rustc_errors::DiagnosticBuilder<'_>) {
42-
err.note(&format!(
42+
err.note(
4343
"this behavior recently changed as a result of a bug fix; \
44-
see rust-lang/rust#56105 for details"
45-
));
44+
see rust-lang/rust#56105 for details",
45+
);
4646
}
4747

4848
/// If there are types that satisfy both impls, invokes `on_overlap`

src/librustc_infer/traits/error_reporting/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -935,9 +935,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
935935

936936
// Already reported in the query.
937937
ConstEvalFailure(ErrorHandled::Reported) => {
938-
self.tcx
939-
.sess
940-
.delay_span_bug(span, &format!("constant in type had an ignored error"));
938+
self.tcx.sess.delay_span_bug(span, "constant in type had an ignored error");
941939
return;
942940
}
943941

src/librustc_metadata/creader.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -680,10 +680,7 @@ impl<'a> CrateLoader<'a> {
680680

681681
// Sanity check the loaded crate to ensure it is indeed a profiler runtime
682682
if !data.is_profiler_runtime() {
683-
self.sess.err(&format!(
684-
"the crate `profiler_builtins` is not \
685-
a profiler runtime"
686-
));
683+
self.sess.err("the crate `profiler_builtins` is not a profiler runtime");
687684
}
688685
}
689686
}

src/librustc_mir/transform/check_consts/ops.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,8 @@ impl NonConstOp for Downcast {
6565
pub struct FnCallIndirect;
6666
impl NonConstOp for FnCallIndirect {
6767
fn emit_error(&self, item: &Item<'_, '_>, span: Span) {
68-
let mut err = item
69-
.tcx
70-
.sess
71-
.struct_span_err(span, &format!("function pointers are not allowed in const fn"));
68+
let mut err =
69+
item.tcx.sess.struct_span_err(span, "function pointers are not allowed in const fn");
7270
err.emit();
7371
}
7472
}

src/librustc_parse/parser/generics.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,12 @@ impl<'a> Parser<'a> {
121121
.span_label(attrs[0].span, "attributes must go before parameters")
122122
.emit();
123123
} else {
124-
self.struct_span_err(
125-
attrs[0].span,
126-
&format!("attribute without generic parameters"),
127-
)
128-
.span_label(
129-
attrs[0].span,
130-
"attributes are only permitted when preceding parameters",
131-
)
132-
.emit();
124+
self.struct_span_err(attrs[0].span, "attribute without generic parameters")
125+
.span_label(
126+
attrs[0].span,
127+
"attributes are only permitted when preceding parameters",
128+
)
129+
.emit();
133130
}
134131
}
135132
break;

src/librustc_passes/weak_lang_items.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ fn verify<'tcx>(tcx: TyCtxt<'tcx>, items: &lang_items::LanguageItems) {
6464
for (name, &item) in WEAK_ITEMS_REFS.iter() {
6565
if missing.contains(&item) && !whitelisted(tcx, item) && items.require(item).is_err() {
6666
if item == lang_items::PanicImplLangItem {
67-
tcx.sess.err(&format!("`#[panic_handler]` function required, but not found"));
67+
tcx.sess.err("`#[panic_handler]` function required, but not found");
6868
} else if item == lang_items::OomLangItem {
69-
tcx.sess.err(&format!("`#[alloc_error_handler]` function required, but not found"));
69+
tcx.sess.err("`#[alloc_error_handler]` function required, but not found");
7070
} else {
7171
tcx.sess.err(&format!("language item required, but not found: `{}`", name));
7272
}

0 commit comments

Comments
 (0)