Skip to content

Commit 6aa04b1

Browse files
authored
test: black box bench inputs (#81)
1 parent 341d47c commit 6aa04b1

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

benches/display.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,38 @@ impl fmt::Display for ByteSizeAlwaysPad {
1212

1313
#[divan::bench]
1414
fn display_inner_display() {
15-
black_box(format!("{}", bytesize::ByteSize::kib(42).display()));
15+
black_box(format!(
16+
"{}",
17+
black_box(bytesize::ByteSize::kib(42).display()),
18+
));
1619
}
1720

1821
#[divan::bench]
1922
fn display_bytesize_standard() {
20-
black_box(format!("{}", bytesize::ByteSize::kib(42).display()));
23+
black_box(format!(
24+
"{}",
25+
black_box(bytesize::ByteSize::kib(42).display()),
26+
));
2127
}
2228

2329
#[divan::bench]
2430
fn display_bytesize_custom() {
25-
black_box(format!("|{:-^10}|", bytesize::ByteSize::kib(42)));
31+
black_box(format!("|{:-^10}|", black_box(bytesize::ByteSize::kib(42))));
2632
}
2733

2834
#[divan::bench]
2935
fn display_always_pad_standard() {
3036
black_box(format!(
3137
"{}",
32-
ByteSizeAlwaysPad(bytesize::ByteSize::kib(42))
38+
black_box(ByteSizeAlwaysPad(bytesize::ByteSize::kib(42))),
3339
));
3440
}
3541

3642
#[divan::bench]
3743
fn display_always_pad_custom() {
3844
black_box(format!(
3945
"|{:-^10}|",
40-
ByteSizeAlwaysPad(bytesize::ByteSize::kib(42))
46+
black_box(ByteSizeAlwaysPad(bytesize::ByteSize::kib(42))),
4147
));
4248
}
4349

0 commit comments

Comments
 (0)