Skip to content

Commit

Permalink
Remove unneeded copy
Browse files Browse the repository at this point in the history
  • Loading branch information
Xaeroxe committed Sep 5, 2017
1 parent 398aaff commit 0e2427c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/liballoc/vec.rs
Expand Up @@ -2691,7 +2691,8 @@ impl<'a, T, F> Iterator for DrainFilter<'a, T, F>
self.del += 1;
return Some(ptr::read(&v[i]));
} else if self.del > 0 {
v.swap(i - self.del, i);
let del = self.del;
ptr::copy_nonoverlapping(self.vec.as_ptr().offset(i), self.vec.as_mut_ptr().offset(i - del), 1);
}
}
None
Expand Down

0 comments on commit 0e2427c

Please sign in to comment.