Skip to content

Commit

Permalink
Auto merge of #25301 - jooert:vec_map_fix_split_off, r=Gankro
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed May 11, 2015
2 parents f697041 + 5b0e197 commit 0a41c4a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libcollections/vec_map.rs
Expand Up @@ -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;
}
Expand Down

0 comments on commit 0a41c4a

Please sign in to comment.