about summary refs log tree commit diff
path: root/compiler/rustc_session/src/session.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-03-26 06:00:41 +0000
committerbors <bors@rust-lang.org>2022-03-26 06:00:41 +0000
commit2882c2023d6e1dee4128611e89fcde0cf6199f6d (patch)
treef6868f456343f5361c9274b51674c1aedf8fa3d7 /compiler/rustc_session/src/session.rs
parentd4acac935b6dd6413964b068421d8d12441f702e (diff)
parentfd2448b5fc9908ba5bdde152540e4935c48a7a86 (diff)
downloadrust-2882c2023d6e1dee4128611e89fcde0cf6199f6d.tar.gz
rust-2882c2023d6e1dee4128611e89fcde0cf6199f6d.zip
Auto merge of #95296 - workingjubilee:pretty-session, r=Dylan-DPC
Prettify rustc_session with recent conveniences

No functional changes.

I felt like making something beautiful.
Diffstat (limited to 'compiler/rustc_session/src/session.rs')
-rw-r--r--compiler/rustc_session/src/session.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs
index 4b2eea5c2cb..4876e2eb851 100644
--- a/compiler/rustc_session/src/session.rs
+++ b/compiler/rustc_session/src/session.rs
@@ -87,7 +87,7 @@ impl From<usize> for Limit {
 
 impl fmt::Display for Limit {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        write!(f, "{}", self.0)
+        self.0.fmt(f)
     }
 }
 
@@ -225,8 +225,8 @@ impl Session {
             let mut diag = self.struct_warn("skipping const checks");
             for &(span, feature_gate) in unleashed_features.iter() {
                 // FIXME: `span_label` doesn't do anything, so we use "help" as a hack.
-                if let Some(feature_gate) = feature_gate {
-                    diag.span_help(span, &format!("skipping check for `{}` feature", feature_gate));
+                if let Some(gate) = feature_gate {
+                    diag.span_help(span, &format!("skipping check for `{gate}` feature"));
                     // The unleash flag must *not* be used to just "hack around" feature gates.
                     must_err = true;
                 } else {
@@ -1133,7 +1133,7 @@ pub fn build_session(
     let target_cfg = config::build_target_config(&sopts, target_override, &sysroot);
     let host_triple = TargetTriple::from_triple(config::host_triple());
     let (host, target_warnings) = Target::search(&host_triple, &sysroot).unwrap_or_else(|e| {
-        early_error(sopts.error_format, &format!("Error loading host specification: {}", e))
+        early_error(sopts.error_format, &format!("Error loading host specification: {e}"))
     });
     for warning in target_warnings.warning_messages() {
         early_warn(sopts.error_format, &warning)
@@ -1172,7 +1172,7 @@ pub fn build_session(
         match profiler {
             Ok(profiler) => Some(Arc::new(profiler)),
             Err(e) => {
-                early_warn(sopts.error_format, &format!("failed to create profiler: {}", e));
+                early_warn(sopts.error_format, &format!("failed to create profiler: {e}"));
                 None
             }
         }
@@ -1335,7 +1335,7 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
     // Cannot mix and match sanitizers.
     let mut sanitizer_iter = sess.opts.debugging_opts.sanitizer.into_iter();
     if let (Some(first), Some(second)) = (sanitizer_iter.next(), sanitizer_iter.next()) {
-        sess.err(&format!("`-Zsanitizer={}` is incompatible with `-Zsanitizer={}`", first, second));
+        sess.err(&format!("`-Zsanitizer={first}` is incompatible with `-Zsanitizer={second}`"));
     }
 
     // Cannot enable crt-static with sanitizers on Linux