about summary refs log tree commit diff
path: root/library/test/src/console.rs
diff options
context:
space:
mode:
authorT-O-R-U-S <bageliq@protonmail.com>2022-02-12 23:16:17 +0400
committerMark Rousskov <mark.simulacrum@gmail.com>2022-03-10 10:23:40 -0500
commit72a25d05bf1a4b155d74139ef700ff93af6d8e22 (patch)
tree3f143b29a3a51b68e9b29d93e47fb0b0968ad3df /library/test/src/console.rs
parentba14a836c7038da21f5e102aacc7e6d5964f79a6 (diff)
downloadrust-72a25d05bf1a4b155d74139ef700ff93af6d8e22.tar.gz
rust-72a25d05bf1a4b155d74139ef700ff93af6d8e22.zip
Use implicit capture syntax in format_args
This updates the standard library's documentation to use the new syntax. The
documentation is worthwhile to update as it should be more idiomatic
(particularly for features like this, which are nice for users to get acquainted
with). The general codebase is likely more hassle than benefit to update: it'll
hurt git blame, and generally updates can be done by folks updating the code if
(and when) that makes things more readable with the new format.

A few places in the compiler and library code are updated (mostly just due to
already having been done when this commit was first authored).
Diffstat (limited to 'library/test/src/console.rs')
-rw-r--r--library/test/src/console.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/library/test/src/console.rs b/library/test/src/console.rs
index 22fcd77dccc..c7e8507113e 100644
--- a/library/test/src/console.rs
+++ b/library/test/src/console.rs
@@ -114,11 +114,11 @@ impl ConsoleTestState {
                 match *result {
                     TestResult::TrOk => "ok".to_owned(),
                     TestResult::TrFailed => "failed".to_owned(),
-                    TestResult::TrFailedMsg(ref msg) => format!("failed: {}", msg),
+                    TestResult::TrFailedMsg(ref msg) => format!("failed: {msg}"),
                     TestResult::TrIgnored => {
                         #[cfg(not(bootstrap))]
                         if let Some(msg) = ignore_message {
-                            format!("ignored, {}", msg)
+                            format!("ignored, {msg}")
                         } else {
                             "ignored".to_owned()
                         }
@@ -132,7 +132,7 @@ impl ConsoleTestState {
             )
         })?;
         if let Some(exec_time) = exec_time {
-            self.write_log(|| format!(" <{}>", exec_time))?;
+            self.write_log(|| format!(" <{exec_time}>"))?;
         }
         self.write_log(|| "\n")
     }
@@ -171,14 +171,14 @@ pub fn list_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Res
             }
         };
 
-        writeln!(output, "{}: {}", name, fntype)?;
-        st.write_log(|| format!("{} {}\n", fntype, name))?;
+        writeln!(output, "{name}: {fntype}")?;
+        st.write_log(|| format!("{fntype} {name}\n"))?;
     }
 
     fn plural(count: u32, s: &str) -> String {
         match count {
-            1 => format!("{} {}", 1, s),
-            n => format!("{} {}s", n, s),
+            1 => format!("1 {s}"),
+            n => format!("{n} {s}s"),
         }
     }
 
@@ -218,7 +218,7 @@ fn handle_test_result(st: &mut ConsoleTestState, completed_test: CompletedTest)
         TestResult::TrFailedMsg(msg) => {
             st.failed += 1;
             let mut stdout = stdout;
-            stdout.extend_from_slice(format!("note: {}", msg).as_bytes());
+            stdout.extend_from_slice(format!("note: {msg}").as_bytes());
             st.failures.push((test, stdout));
         }
         TestResult::TrTimedFail => {