about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-05-11 16:20:49 +0000
committerbors <bors@rust-lang.org>2015-05-11 16:20:49 +0000
commit0a41c4a33d8d069dff9f4da2870bec9aaf72ea6c (patch)
treea27c0be51b8296f24ebac6a91c2cc790e86eb907
parentf697041b37e8c9c86dfe463262501ad61dd2d4a3 (diff)
parent5b0e19794efe6d2d7f225df57505205627103f32 (diff)
downloadrust-0a41c4a33d8d069dff9f4da2870bec9aaf72ea6c.tar.gz
rust-0a41c4a33d8d069dff9f4da2870bec9aaf72ea6c.zip
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
-rw-r--r--src/libcollections/vec_map.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs
index 6ff819fc87c..aa0ab41b745 100644
--- a/src/libcollections/vec_map.rs
+++ b/src/libcollections/vec_map.rs
@@ -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;
         }