diff --git a/lib.rs b/lib.rs index 2968808..0dd92ef 100644 --- a/lib.rs +++ b/lib.rs @@ -221,9 +221,9 @@ macro_rules! def_small_vector( } pub fn grow(&mut self, new_cap: usize) { + let mut vec: Vec = Vec::with_capacity(new_cap); + let new_alloc = vec.as_mut_ptr(); unsafe { - let mut vec: Vec = Vec::with_capacity(new_cap); - let new_alloc = vec.as_mut_ptr(); mem::forget(vec); ptr::copy_nonoverlapping(self.begin(), new_alloc, self.len());