Skip to content

Commit

Permalink
collections: grow should use the overflow-checked reserve_additional
Browse files Browse the repository at this point in the history
  • Loading branch information
erickt authored and alexcrichton committed Jul 3, 2014
1 parent 7db691e commit e7adb84
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/libcollections/vec.rs
Expand Up @@ -253,8 +253,7 @@ impl<T: Clone> Vec<T> {
/// assert_eq!(vec, vec!("hello", "world", "world"));
/// ```
pub fn grow(&mut self, n: uint, value: &T) {
let new_len = self.len() + n;
self.reserve(new_len);
self.reserve_additional(n);
let mut i: uint = 0u;

while i < n {
Expand Down

0 comments on commit e7adb84

Please sign in to comment.