Skip to content

Commit

Permalink
Simplify extend_impl
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrubeck committed Dec 18, 2024
1 parent 99e5c5d commit a176a87
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1502,11 +1502,11 @@ impl<T, const N: usize> SmallVec<T, N> {
let mut iter = iter.fuse();
let (lower_bound, _) = iter.size_hint();
self.reserve(lower_bound);
let mut len = self.len();
let mut capacity = self.capacity();
let mut ptr = self.as_mut_ptr();
unsafe {
loop {
let mut len = self.len();
// SAFETY: ptr is valid for `capacity - len` writes
ptr = ptr.add(len);
let mut guard = DropGuard { ptr, len: 0 };
Expand All @@ -1520,7 +1520,6 @@ impl<T, const N: usize> SmallVec<T, N> {
// At this point we either consumed all capacity or the iterator is exhausted (fused)
if let Some(item) = iter.next() {
self.push(item);
len += 1;
} else {
return;
}
Expand Down

0 comments on commit a176a87

Please sign in to comment.