From 6c5c47b82b982d385eaff1d959bf716925f096f6 Mon Sep 17 00:00:00 2001 From: The8472 Date: Sat, 16 Nov 2019 17:27:39 +0100 Subject: [PATCH] update benches --- library/alloc/benches/vec.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/library/alloc/benches/vec.rs b/library/alloc/benches/vec.rs index 2eee988dccc..6a3d7046126 100644 --- a/library/alloc/benches/vec.rs +++ b/library/alloc/benches/vec.rs @@ -440,10 +440,11 @@ macro_rules! bench_in_place { #[bench] fn $fname(b: &mut Bencher) { b.iter(|| { - let src: Vec<$type> = vec![$init; $count]; - black_box(src.into_iter() + let src: Vec<$type> = black_box(vec![$init; $count]); + let mut sink = src.into_iter() .enumerate() - .map(|(idx, e)| { (idx as $type) ^ e }).collect::>()) + .map(|(idx, e)| { (idx as $type) ^ e }).collect::>(); + black_box(sink.as_mut_ptr()) }); } )+