Minor optimization for VecMap::split_off
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()`.
This commit is contained in:
parent
c44d84da98
commit
5b0e19794e
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user