Skip to content

Commit 0e03cbd

Browse files
committed
bench: do not touch the benchmark.rs .
1 parent 2f3d382 commit 0e03cbd

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tests/benchmark.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use std::collections::HashMap;
88
use std::env;
9-
use std::hint::black_box;
109
use std::time::{Duration, Instant};
1110

1211
const CAPACITY: usize = 1;
@@ -19,7 +18,7 @@ macro_rules! eval {
1918
let _ = $map.insert(0, 42);
2019
for i in 1..$capacity - 1 {
2120
let _ = $map.insert(i as u32, i as i64);
22-
let v = black_box(*$map.get(&(i as u32)).unwrap());
21+
let v = std::hint::black_box(*$map.get(&(i as u32)).unwrap());
2322
assert_eq!(v, i as i64);
2423
}
2524
for i in 1..$capacity - 1 {
@@ -30,9 +29,9 @@ macro_rules! eval {
3029
if $map.iter().find(|(_k, v)| **v == 0).is_some() {
3130
$map.clear();
3231
}
33-
sum += black_box($map.iter().find(|(_k, v)| **v == 42).unwrap().1);
32+
sum += std::hint::black_box($map.iter().find(|(_k, v)| **v == 42).unwrap().1);
3433
}
35-
black_box(sum)
34+
std::hint::black_box(sum)
3635
}};
3736
}
3837

0 commit comments

Comments
 (0)