Skip to content

Commit

Permalink
Auto merge of #64 - mbrubeck:pop, r=emilio
Browse files Browse the repository at this point in the history
Simplify unsafe pointer code in SmallVec::pop

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/64)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo authored Sep 20, 2017
2 parents 631e1c2 + 3a27c0a commit a990f5d
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 @@ -432,8 +432,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 a990f5d

Please sign in to comment.