about summary refs log tree commit diff
path: root/compiler/rustc_errors/src/emitter.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-07-24 17:47:10 +0200
committerGitHub <noreply@github.com>2023-07-24 17:47:10 +0200
commit974a1c242f78ccfb94e43b5c45fc7be501c00d1c (patch)
treec8c1bf6a909072195f1272e03ca2d06106f550a6 /compiler/rustc_errors/src/emitter.rs
parent4d2f98d306c93e53556e86e48d029f774bae79b5 (diff)
parente36b901933bbd4e747a7eddfbadf23bda93eba02 (diff)
downloadrust-974a1c242f78ccfb94e43b5c45fc7be501c00d1c.tar.gz
rust-974a1c242f78ccfb94e43b5c45fc7be501c00d1c.zip
Rollup merge of #113993 - nyurik:ref_format_errors, r=WaffleLapkin
Optimize format usage

Per #112156, using `&` in `format!` may cause a small perf delay, so I tried to clean up one module at a time format usage. This PR includes a few removals of the ref in format (they do compile locally without the ref), as well as a few format inlining for consistency.
Diffstat (limited to 'compiler/rustc_errors/src/emitter.rs')
-rw-r--r--compiler/rustc_errors/src/emitter.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs
index a0fa4115c3e..961feba3250 100644
--- a/compiler/rustc_errors/src/emitter.rs
+++ b/compiler/rustc_errors/src/emitter.rs
@@ -279,12 +279,12 @@ pub trait Emitter: Translate {
                 let msg = if substitution.is_empty() || sugg.style.hide_inline() {
                     // This substitution is only removal OR we explicitly don't want to show the
                     // code inline (`hide_inline`). Therefore, we don't show the substitution.
-                    format!("help: {}", &msg)
+                    format!("help: {msg}")
                 } else {
                     // Show the default suggestion text with the substitution
                     format!(
                         "help: {}{}: `{}`",
-                        &msg,
+                        msg,
                         if self.source_map().is_some_and(|sm| is_case_difference(
                             sm,
                             substitution,