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
This commit is contained in:
commit
0a41c4a33d
1 changed files with 1 additions and 1 deletions
|
@ -367,7 +367,7 @@ impl<V> VecMap<V> {
|
||||||
// Move all elements to other
|
// Move all elements to other
|
||||||
swap(self, &mut other);
|
swap(self, &mut other);
|
||||||
return other
|
return other
|
||||||
} else if at > self.v.len() {
|
} else if at >= self.v.len() {
|
||||||
// No elements to copy
|
// No elements to copy
|
||||||
return other;
|
return other;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue