mirror of
https://github.com/openharmony/third_party_rust_rust-smallvec.git
synced 2026-07-21 01:55:25 -04:00
Simplify unsafe pointer code in SmallVec::pop
This commit is contained in:
@@ -412,8 +412,8 @@ impl<A: Array> SmallVec<A> {
|
||||
panic!("overflow")
|
||||
}
|
||||
unsafe {
|
||||
let end_ptr = self.as_mut_ptr().offset(last_index as isize);
|
||||
let value = ptr::replace(end_ptr, mem::uninitialized());
|
||||
let end_ptr = self.as_ptr().offset(last_index as isize);
|
||||
let value = ptr::read(end_ptr);
|
||||
self.set_len(last_index);
|
||||
Some(value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user