Skip to content

Commit

Permalink
remove needs_drop
Browse files Browse the repository at this point in the history
  • Loading branch information
the8472 committed Nov 7, 2020
1 parent b2d115f commit 8c7046e
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions library/alloc/src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2136,10 +2136,8 @@ impl<T> InPlaceDrop<T> {
impl<T> Drop for InPlaceDrop<T> {
#[inline]
fn drop(&mut self) {
if mem::needs_drop::<T>() {
unsafe {
ptr::drop_in_place(slice::from_raw_parts_mut(self.inner, self.len()));
}
unsafe {
ptr::drop_in_place(slice::from_raw_parts_mut(self.inner, self.len()));
}
}
}
Expand Down Expand Up @@ -2871,10 +2869,8 @@ impl<T> IntoIter<T> {
}

fn drop_remaining(&mut self) {
if mem::needs_drop::<T>() {
unsafe {
ptr::drop_in_place(self.as_mut_slice());
}
unsafe {
ptr::drop_in_place(self.as_mut_slice());
}
self.ptr = self.end;
}
Expand Down

0 comments on commit 8c7046e

Please sign in to comment.