Skip to content

Commit 8d18e57

Browse files
committed
Fix the bench_max and bench_max_by_key benchmarks
1 parent 88f755f commit 8d18e57

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libcore/benches/iter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fn scatter(x: i32) -> i32 { (x * 31) % 127 }
3535
fn bench_max_by_key(b: &mut Bencher) {
3636
b.iter(|| {
3737
let it = 0..100;
38-
it.max_by_key(|&x| scatter(x))
38+
it.map(black_box).max_by_key(|&x| scatter(x))
3939
})
4040
}
4141

@@ -56,7 +56,7 @@ fn bench_max_by_key2(b: &mut Bencher) {
5656
fn bench_max(b: &mut Bencher) {
5757
b.iter(|| {
5858
let it = 0..100;
59-
it.map(scatter).max()
59+
it.map(black_box).map(scatter).max()
6060
})
6161
}
6262

0 commit comments

Comments
 (0)