Skip to content

Commit a990f5d

Browse files
author
bors-servo
authored
Auto merge of #64 - mbrubeck:pop, r=emilio
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 -->
2 parents 631e1c2 + 3a27c0a commit a990f5d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,8 @@ impl<A: Array> SmallVec<A> {
432432
panic!("overflow")
433433
}
434434
unsafe {
435-
let end_ptr = self.as_mut_ptr().offset(last_index as isize);
436-
let value = ptr::replace(end_ptr, mem::uninitialized());
435+
let end_ptr = self.as_ptr().offset(last_index as isize);
436+
let value = ptr::read(end_ptr);
437437
self.set_len(last_index);
438438
Some(value)
439439
}

0 commit comments

Comments
 (0)