FIX: Code cleanup in .into_inner()
Prefer ManuallyDrop instead of forget (more modern style preference - with the benefit that the ManuallyDrop style sets up the non-dropping before taking further actions).
This commit is contained in:
+2
-2
@@ -590,8 +590,8 @@ impl<T, const CAP: usize> ArrayVec<T, CAP> {
|
|||||||
Err(self)
|
Err(self)
|
||||||
} else {
|
} else {
|
||||||
unsafe {
|
unsafe {
|
||||||
let array = ptr::read(self.as_ptr() as *const [T; CAP]);
|
let self_ = ManuallyDrop::new(self);
|
||||||
mem::forget(self);
|
let array = ptr::read(self_.as_ptr() as *const [T; CAP]);
|
||||||
Ok(array)
|
Ok(array)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user