Skip to content

Commit d14c0d2

Browse files
Use ManuallyDrop::take instead of into_inner
Co-authored-by: Daniel Henry-Mantilla <[email protected]>
1 parent 0cf6061 commit d14c0d2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/alloc/src/vec/into_iter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ unsafe impl<#[may_dangle] T, A: Allocator> Drop for IntoIter<T, A> {
315315
fn drop(&mut self) {
316316
unsafe {
317317
// `IntoIter::alloc` is not used anymore after this and will be dropped by RawVec
318-
let alloc = ManuallyDrop::into_inner(ptr::read(&self.0.alloc));
318+
let alloc = ManuallyDrop::take(&mut self.0.alloc);
319319
// RawVec handles deallocation
320320
let _ = RawVec::from_raw_parts_in(self.0.buf.as_ptr(), self.0.cap, alloc);
321321
}

0 commit comments

Comments
 (0)