1
Fork 0

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:
bors 2015-05-11 16:20:49 +00:00
commit 0a41c4a33d

View file

@ -367,7 +367,7 @@ impl<V> VecMap<V> {
// Move all elements to other
swap(self, &mut other);
return other
} else if at > self.v.len() {
} else if at >= self.v.len() {
// No elements to copy
return other;
}