Skip to content

Commit dadcf18

Browse files
committed
STYLE: format benches
1 parent 67ec907 commit dadcf18

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

benches/arraystring.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
21
extern crate arrayvec;
3-
#[macro_use] extern crate bencher;
2+
#[macro_use]
3+
extern crate bencher;
44

55
use arrayvec::ArrayString;
66

@@ -10,8 +10,7 @@ fn try_push_c(b: &mut Bencher) {
1010
let mut v = ArrayString::<512>::new();
1111
b.iter(|| {
1212
v.clear();
13-
while v.try_push('c').is_ok() {
14-
}
13+
while v.try_push('c').is_ok() {}
1514
v.len()
1615
});
1716
b.bytes = v.capacity() as u64;
@@ -21,8 +20,7 @@ fn try_push_alpha(b: &mut Bencher) {
2120
let mut v = ArrayString::<512>::new();
2221
b.iter(|| {
2322
v.clear();
24-
while v.try_push('α').is_ok() {
25-
}
23+
while v.try_push('α').is_ok() {}
2624
v.len()
2725
});
2826
b.bytes = v.capacity() as u64;
@@ -85,6 +83,13 @@ fn push_string(b: &mut Bencher) {
8583
b.bytes = v.capacity() as u64;
8684
}
8785

88-
benchmark_group!(benches, try_push_c, try_push_alpha, try_push_string, push_c,
89-
push_alpha, push_string);
86+
benchmark_group!(
87+
benches,
88+
try_push_c,
89+
try_push_alpha,
90+
try_push_string,
91+
push_c,
92+
push_alpha,
93+
push_string
94+
);
9095
benchmark_main!(benches);

benches/extend.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
21
extern crate arrayvec;
3-
#[macro_use] extern crate bencher;
2+
#[macro_use]
3+
extern crate bencher;
44

55
use std::io::Write;
66

77
use arrayvec::ArrayVec;
88

9-
use bencher::Bencher;
109
use bencher::black_box;
10+
use bencher::Bencher;
1111

1212
fn extend_with_constant(b: &mut Bencher) {
1313
let mut v = ArrayVec::<u8, 512>::new();
@@ -67,12 +67,13 @@ fn extend_from_slice(b: &mut Bencher) {
6767
b.bytes = v.capacity() as u64;
6868
}
6969

70-
benchmark_group!(benches,
71-
extend_with_constant,
72-
extend_with_range,
73-
extend_with_slice,
74-
extend_with_write,
75-
extend_from_slice
70+
benchmark_group!(
71+
benches,
72+
extend_with_constant,
73+
extend_with_range,
74+
extend_with_slice,
75+
extend_with_write,
76+
extend_from_slice
7677
);
7778

7879
benchmark_main!(benches);

0 commit comments

Comments
 (0)