mirror of
https://github.com/openharmony/third_party_rust_rust-smallvec.git
synced 2026-07-21 01:55:25 -04:00
Move some code outside of an unsafe block.
This commit is contained in:
@@ -221,9 +221,9 @@ macro_rules! def_small_vector(
|
||||
}
|
||||
|
||||
pub fn grow(&mut self, new_cap: usize) {
|
||||
let mut vec: Vec<T> = Vec::with_capacity(new_cap);
|
||||
let new_alloc = vec.as_mut_ptr();
|
||||
unsafe {
|
||||
let mut vec: Vec<T> = Vec::with_capacity(new_cap);
|
||||
let new_alloc = vec.as_mut_ptr();
|
||||
mem::forget(vec);
|
||||
ptr::copy_nonoverlapping(self.begin(), new_alloc, self.len());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user