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)
|
||||
} else {
|
||||
unsafe {
|
||||
let array = ptr::read(self.as_ptr() as *const [T; CAP]);
|
||||
mem::forget(self);
|
||||
let self_ = ManuallyDrop::new(self);
|
||||
let array = ptr::read(self_.as_ptr() as *const [T; CAP]);
|
||||
Ok(array)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user