diff options
| author | Jacob Kiesel <kieseljake@gmail.com> | 2017-09-05 15:32:02 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-09-05 15:32:02 -0600 |
| commit | 0e2427cd3c52f251d135b7f8c0d73f93369b6e7e (patch) | |
| tree | 3645485719ac6e078f9261f4f66fd25b5517d280 /src/liballoc | |
| parent | 398aaffc94367ed59420f5ac0b0238c04c9e4fa5 (diff) | |
| download | rust-0e2427cd3c52f251d135b7f8c0d73f93369b6e7e.tar.gz rust-0e2427cd3c52f251d135b7f8c0d73f93369b6e7e.zip | |
Remove unneeded copy
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/vec.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 8141851b8c9..158331af2ae 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -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 |
