Skip to content

Commit

Permalink
Vec::reserve_exact should not shrink
Browse files Browse the repository at this point in the history
reserve_exact should not shrink according to documentation.
  • Loading branch information
stepancheg committed Apr 1, 2014
1 parent b71c02e commit 08e95a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libstd/vec.rs
Expand Up @@ -447,7 +447,7 @@ impl<T> Vec<T> {
/// assert_eq!(vec.capacity(), 11);
/// ```
pub fn reserve_exact(&mut self, capacity: uint) {
if capacity >= self.len {
if capacity > self.cap {
let size = capacity.checked_mul(&size_of::<T>()).expect("capacity overflow");
self.cap = capacity;
unsafe {
Expand Down

0 comments on commit 08e95a8

Please sign in to comment.