mirror of
https://github.com/openharmony/third_party_rust_rust-smallvec.git
synced 2026-07-21 01:55:25 -04:00
Use a single ptr::drop_in_place call instead of a loop
This is what the standard Vec does; see rust-lang/rust#32012.
This commit is contained in:
@@ -1186,10 +1186,7 @@ impl<A: Array> Drop for SmallVec<A> {
|
||||
let (ptr, len) = self.data.heap();
|
||||
Vec::from_raw_parts(ptr, len, self.capacity);
|
||||
} else {
|
||||
let ptr = self.as_mut_ptr();
|
||||
for i in 0..self.len() {
|
||||
ptr::drop_in_place(ptr.offset(i as isize));
|
||||
}
|
||||
ptr::drop_in_place(&mut self[..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user