diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index b8efaa78af3a..d53ecabd5a9c 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -496,7 +496,7 @@ impl Vec { /// assert!(vec.capacity() >= 10); /// ``` pub fn reserve(&mut self, capacity: uint) { - if capacity >= self.len { + if capacity > self.cap { self.reserve_exact(num::next_power_of_two(capacity)) } }