Skip to content

Commit 0a41c4a

Browse files
committed
Auto merge of #25301 - jooert:vec_map_fix_split_off, r=Gankro
We don't need to copy any elements if `at` is behind the last element in the map. The last element is at index `self.v.len() - 1`, so we should not copy if `at` is greater **or equals** `self.v.len()`. r? @gankro
2 parents f697041 + 5b0e197 commit 0a41c4a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libcollections/vec_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ impl<V> VecMap<V> {
367367
// Move all elements to other
368368
swap(self, &mut other);
369369
return other
370-
} else if at > self.v.len() {
370+
} else if at >= self.v.len() {
371371
// No elements to copy
372372
return other;
373373
}

0 commit comments

Comments
 (0)