Vec::reserve_exact should not shrink

reserve_exact should not shrink according to documentation.
This commit is contained in:
Stepan Koltsov 2014-04-01 20:16:59 +00:00
parent b71c02e512
commit 08e95a87b8

@ -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 {