about summary refs log tree commit diff
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2020-09-20 10:35:23 +0200
committerest31 <MTest31@outlook.com>2020-09-20 10:35:23 +0200
commit4bc0e55ac4280be80d8cd0f9bc26bd0949f75494 (patch)
treeeaf18a773b0aade6afab82ebd09d18298373bb30
parent285fc7d704fcdd7b2a37d475d04d5d955490e000 (diff)
downloadrust-4bc0e55ac4280be80d8cd0f9bc26bd0949f75494.tar.gz
rust-4bc0e55ac4280be80d8cd0f9bc26bd0949f75494.zip
Replace write_fmt with write!
Latter is simpler
-rw-r--r--library/test/src/bench.rs20
-rw-r--r--src/tools/unstable-book-gen/src/main.rs4
2 files changed, 12 insertions, 12 deletions
diff --git a/library/test/src/bench.rs b/library/test/src/bench.rs
index e92e5b9829e..83be1cce63d 100644
--- a/library/test/src/bench.rs
+++ b/library/test/src/bench.rs
@@ -61,15 +61,15 @@ pub fn fmt_bench_samples(bs: &BenchSamples) -> String {
     let median = bs.ns_iter_summ.median as usize;
     let deviation = (bs.ns_iter_summ.max - bs.ns_iter_summ.min) as usize;
 
-    output
-        .write_fmt(format_args!(
-            "{:>11} ns/iter (+/- {})",
-            fmt_thousands_sep(median, ','),
-            fmt_thousands_sep(deviation, ',')
-        ))
-        .unwrap();
+    write!(
+        output,
+        "{:>11} ns/iter (+/- {})",
+        fmt_thousands_sep(median, ','),
+        fmt_thousands_sep(deviation, ',')
+    )
+    .unwrap();
     if bs.mb_s != 0 {
-        output.write_fmt(format_args!(" = {} MB/s", bs.mb_s)).unwrap();
+        write!(output, " = {} MB/s", bs.mb_s).unwrap();
     }
     output
 }
@@ -83,9 +83,9 @@ fn fmt_thousands_sep(mut n: usize, sep: char) -> String {
         let base = 10_usize.pow(pow);
         if pow == 0 || trailing || n / base != 0 {
             if !trailing {
-                output.write_fmt(format_args!("{}", n / base)).unwrap();
+                write!(output, "{}", n / base).unwrap();
             } else {
-                output.write_fmt(format_args!("{:03}", n / base)).unwrap();
+                write!(output, "{:03}", n / base).unwrap();
             }
             if pow != 0 {
                 output.push(sep);
diff --git a/src/tools/unstable-book-gen/src/main.rs b/src/tools/unstable-book-gen/src/main.rs
index 387b2acd106..e10f72a47b2 100644
--- a/src/tools/unstable-book-gen/src/main.rs
+++ b/src/tools/unstable-book-gen/src/main.rs
@@ -27,12 +27,12 @@ macro_rules! t {
 
 fn generate_stub_issue(path: &Path, name: &str, issue: u32) {
     let mut file = t!(File::create(path));
-    t!(file.write_fmt(format_args!(include_str!("stub-issue.md"), name = name, issue = issue)));
+    t!(write!(file, include_str!("stub-issue.md"), name = name, issue = issue));
 }
 
 fn generate_stub_no_issue(path: &Path, name: &str) {
     let mut file = t!(File::create(path));
-    t!(file.write_fmt(format_args!(include_str!("stub-no-issue.md"), name = name)));
+    t!(write!(file, include_str!("stub-no-issue.md"), name = name));
 }
 
 fn set_to_summary_str(set: &BTreeSet<String>, dir: &str) -> String {