Skip to content

Commit a176a87

Browse files
committed
Simplify extend_impl
1 parent 99e5c5d commit a176a87

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1502,11 +1502,11 @@ impl<T, const N: usize> SmallVec<T, N> {
15021502
let mut iter = iter.fuse();
15031503
let (lower_bound, _) = iter.size_hint();
15041504
self.reserve(lower_bound);
1505-
let mut len = self.len();
15061505
let mut capacity = self.capacity();
15071506
let mut ptr = self.as_mut_ptr();
15081507
unsafe {
15091508
loop {
1509+
let mut len = self.len();
15101510
// SAFETY: ptr is valid for `capacity - len` writes
15111511
ptr = ptr.add(len);
15121512
let mut guard = DropGuard { ptr, len: 0 };
@@ -1520,7 +1520,6 @@ impl<T, const N: usize> SmallVec<T, N> {
15201520
// At this point we either consumed all capacity or the iterator is exhausted (fused)
15211521
if let Some(item) = iter.next() {
15221522
self.push(item);
1523-
len += 1;
15241523
} else {
15251524
return;
15261525
}

0 commit comments

Comments
 (0)