Skip to content

Commit

Permalink
Rollup merge of rust-lang#77044 - pickfire:patch-4, r=jyn514
Browse files Browse the repository at this point in the history
Liballoc bench vec use mem take not replace
  • Loading branch information
ecstatic-morse authored Sep 22, 2020
2 parents cff8489 + 4a6bc77 commit a41b5cc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions library/alloc/benches/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ fn bench_extend_recycle(b: &mut Bencher) {
let mut data = vec![0; 1000];

b.iter(|| {
let tmp = std::mem::replace(&mut data, Vec::new());
let tmp = std::mem::take(&mut data);
let mut to_extend = black_box(Vec::new());
to_extend.extend(tmp.into_iter());
data = black_box(to_extend);
Expand Down Expand Up @@ -500,7 +500,7 @@ fn bench_in_place_recycle(b: &mut Bencher) {
let mut data = vec![0; 1000];

b.iter(|| {
let tmp = std::mem::replace(&mut data, Vec::new());
let tmp = std::mem::take(&mut data);
data = black_box(
tmp.into_iter()
.enumerate()
Expand All @@ -520,7 +520,7 @@ fn bench_in_place_zip_recycle(b: &mut Bencher) {
rng.fill_bytes(&mut subst[..]);

b.iter(|| {
let tmp = std::mem::replace(&mut data, Vec::new());
let tmp = std::mem::take(&mut data);
let mangled = tmp
.into_iter()
.zip(subst.iter().copied())
Expand Down

0 comments on commit a41b5cc

Please sign in to comment.