about summary refs log tree commit diff
diff options
context:
space:
mode:
authornils <48135649+Nilstrieb@users.noreply.github.com>2022-12-19 08:48:30 +0100
committernils <48135649+Nilstrieb@users.noreply.github.com>2022-12-19 08:58:40 +0100
commit5fb2d63d0793a4c3c612d1e4a4ca6a184e6fe614 (patch)
treedb18507b08639299650830aa63169ec86e9e6798
parent224fa3907e319405fdabdb06c33f99b896754773 (diff)
downloadrust-5fb2d63d0793a4c3c612d1e4a4ca6a184e6fe614.tar.gz
rust-5fb2d63d0793a4c3c612d1e4a4ca6a184e6fe614.zip
Fix `uninlined_format_args` in libtest
-rw-r--r--library/test/src/cli.rs12
-rw-r--r--library/test/src/formatters/json.rs7
-rw-r--r--library/test/src/formatters/mod.rs2
-rw-r--r--library/test/src/formatters/pretty.rs2
-rw-r--r--library/test/src/lib.rs5
-rw-r--r--library/test/src/test_result.rs5
-rw-r--r--library/test/src/time.rs6
7 files changed, 15 insertions, 24 deletions
diff --git a/library/test/src/cli.rs b/library/test/src/cli.rs
index 524658bce13..796796e07a9 100644
--- a/library/test/src/cli.rs
+++ b/library/test/src/cli.rs
@@ -354,8 +354,7 @@ fn get_shuffle_seed(matches: &getopts::Matches, allow_unstable: bool) -> OptPart
             Err(e) => {
                 return Err(format!(
                     "argument for --shuffle-seed must be a number \
-                     (error: {})",
-                    e
+                     (error: {e})"
                 ));
             }
         },
@@ -383,8 +382,7 @@ fn get_test_threads(matches: &getopts::Matches) -> OptPartRes<Option<usize>> {
             Err(e) => {
                 return Err(format!(
                     "argument for --test-threads must be a number > 0 \
-                     (error: {})",
-                    e
+                     (error: {e})"
                 ));
             }
         },
@@ -418,8 +416,7 @@ fn get_format(
         Some(v) => {
             return Err(format!(
                 "argument for --format must be pretty, terse, json or junit (was \
-                 {})",
-                v
+                 {v})"
             ));
         }
     };
@@ -436,8 +433,7 @@ fn get_color_config(matches: &getopts::Matches) -> OptPartRes<ColorConfig> {
         Some(v) => {
             return Err(format!(
                 "argument for --color must be auto, always, or never (was \
-                 {})",
-                v
+                 {v})"
             ));
         }
     };
diff --git a/library/test/src/formatters/json.rs b/library/test/src/formatters/json.rs
index c07fdafb167..5526aadb67f 100644
--- a/library/test/src/formatters/json.rs
+++ b/library/test/src/formatters/json.rs
@@ -53,7 +53,7 @@ impl<T: Write> JsonFormatter<T> {
             self.write_message(&*format!(r#", "stdout": "{}""#, EscapedString(stdout)))?;
         }
         if let Some(extra) = extra {
-            self.write_message(&*format!(r#", {}"#, extra))?;
+            self.write_message(&*format!(r#", {extra}"#))?;
         }
         self.writeln_message(" }")
     }
@@ -62,13 +62,12 @@ impl<T: Write> JsonFormatter<T> {
 impl<T: Write> OutputFormatter for JsonFormatter<T> {
     fn write_run_start(&mut self, test_count: usize, shuffle_seed: Option<u64>) -> io::Result<()> {
         let shuffle_seed_json = if let Some(shuffle_seed) = shuffle_seed {
-            format!(r#", "shuffle_seed": {}"#, shuffle_seed)
+            format!(r#", "shuffle_seed": {shuffle_seed}"#)
         } else {
             String::new()
         };
         self.writeln_message(&*format!(
-            r#"{{ "type": "suite", "event": "started", "test_count": {}{} }}"#,
-            test_count, shuffle_seed_json
+            r#"{{ "type": "suite", "event": "started", "test_count": {test_count}{shuffle_seed_json} }}"#
         ))
     }
 
diff --git a/library/test/src/formatters/mod.rs b/library/test/src/formatters/mod.rs
index cb80859759f..cb67b6491a3 100644
--- a/library/test/src/formatters/mod.rs
+++ b/library/test/src/formatters/mod.rs
@@ -38,5 +38,5 @@ pub(crate) fn write_stderr_delimiter(test_output: &mut Vec<u8>, test_name: &Test
         Some(_) => test_output.push(b'\n'),
         None => (),
     }
-    writeln!(test_output, "---- {} stderr ----", test_name).unwrap();
+    writeln!(test_output, "---- {test_name} stderr ----").unwrap();
 }
diff --git a/library/test/src/formatters/pretty.rs b/library/test/src/formatters/pretty.rs
index 69420222980..0299c8b5433 100644
--- a/library/test/src/formatters/pretty.rs
+++ b/library/test/src/formatters/pretty.rs
@@ -47,7 +47,7 @@ impl<T: Write> PrettyFormatter<T> {
 
     pub fn write_ignored(&mut self, message: Option<&'static str>) -> io::Result<()> {
         if let Some(message) = message {
-            self.write_short_result(&format!("ignored, {}", message), term::color::YELLOW)
+            self.write_short_result(&format!("ignored, {message}"), term::color::YELLOW)
         } else {
             self.write_short_result("ignored", term::color::YELLOW)
         }
diff --git a/library/test/src/lib.rs b/library/test/src/lib.rs
index 256c9e8d141..f6a41bbb88c 100644
--- a/library/test/src/lib.rs
+++ b/library/test/src/lib.rs
@@ -213,8 +213,7 @@ pub fn assert_test_result<T: Termination>(result: T) -> Result<(), String> {
     } else {
         Err(format!(
             "the test returned a termination value with a non-zero status code \
-             ({}) which indicates a failure",
-            code
+             ({code}) which indicates a failure"
         ))
     }
 }
@@ -750,7 +749,7 @@ fn spawn_test_subprocess(
         })() {
             Ok(r) => r,
             Err(e) => {
-                write!(&mut test_output, "Unexpected error: {}", e).unwrap();
+                write!(&mut test_output, "Unexpected error: {e}").unwrap();
                 TrFailed
             }
         };
diff --git a/library/test/src/test_result.rs b/library/test/src/test_result.rs
index 7f44d6e3d0f..7c5b0d6c0f7 100644
--- a/library/test/src/test_result.rs
+++ b/library/test/src/test_result.rs
@@ -44,9 +44,8 @@ pub fn calc_result<'a>(
             } else if let Some(panic_str) = maybe_panic_str {
                 TestResult::TrFailedMsg(format!(
                     r#"panic did not contain expected string
-      panic message: `{:?}`,
- expected substring: `{:?}`"#,
-                    panic_str, msg
+      panic message: `{panic_str:?}`,
+ expected substring: `{msg:?}`"#
                 ))
             } else {
                 TestResult::TrFailedMsg(format!(
diff --git a/library/test/src/time.rs b/library/test/src/time.rs
index 8c64e5d1b73..7fd69d7f7e7 100644
--- a/library/test/src/time.rs
+++ b/library/test/src/time.rs
@@ -107,16 +107,14 @@ impl TimeThreshold {
         let durations_str = env::var(env_var_name).ok()?;
         let (warn_str, critical_str) = durations_str.split_once(',').unwrap_or_else(|| {
             panic!(
-                "Duration variable {} expected to have 2 numbers separated by comma, but got {}",
-                env_var_name, durations_str
+                "Duration variable {env_var_name} expected to have 2 numbers separated by comma, but got {durations_str}"
             )
         });
 
         let parse_u64 = |v| {
             u64::from_str(v).unwrap_or_else(|_| {
                 panic!(
-                    "Duration value in variable {} is expected to be a number, but got {}",
-                    env_var_name, v
+                    "Duration value in variable {env_var_name} is expected to be a number, but got {v}"
                 )
             })
         };