Skip to content

Commit 7a87d0d

Browse files
authored
Rollup merge of rust-lang#76959 - est31:write, r=oli-obk
Replace write_fmt with write! Latter is simpler
2 parents c08034d + 25708e2 commit 7a87d0d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

test/src/bench.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ pub fn fmt_bench_samples(bs: &BenchSamples) -> String {
6161
let median = bs.ns_iter_summ.median as usize;
6262
let deviation = (bs.ns_iter_summ.max - bs.ns_iter_summ.min) as usize;
6363

64-
output
65-
.write_fmt(format_args!(
66-
"{:>11} ns/iter (+/- {})",
67-
fmt_thousands_sep(median, ','),
68-
fmt_thousands_sep(deviation, ',')
69-
))
70-
.unwrap();
64+
write!(
65+
output,
66+
"{:>11} ns/iter (+/- {})",
67+
fmt_thousands_sep(median, ','),
68+
fmt_thousands_sep(deviation, ',')
69+
)
70+
.unwrap();
7171
if bs.mb_s != 0 {
72-
output.write_fmt(format_args!(" = {} MB/s", bs.mb_s)).unwrap();
72+
write!(output, " = {} MB/s", bs.mb_s).unwrap();
7373
}
7474
output
7575
}
@@ -83,9 +83,9 @@ fn fmt_thousands_sep(mut n: usize, sep: char) -> String {
8383
let base = 10_usize.pow(pow);
8484
if pow == 0 || trailing || n / base != 0 {
8585
if !trailing {
86-
output.write_fmt(format_args!("{}", n / base)).unwrap();
86+
write!(output, "{}", n / base).unwrap();
8787
} else {
88-
output.write_fmt(format_args!("{:03}", n / base)).unwrap();
88+
write!(output, "{:03}", n / base).unwrap();
8989
}
9090
if pow != 0 {
9191
output.push(sep);

0 commit comments

Comments
 (0)