Skip to content

Commit

Permalink
Simplify unsafe pointer code in SmallVec::pop
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrubeck committed Sep 19, 2017
1 parent ffbbbc8 commit 3a27c0a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 3a27c0a

Please sign in to comment.