collections: grow should use the overflow-checked reserve_additional
This commit is contained in:
parent
7db691e010
commit
e7adb8434a
1 changed files with 1 additions and 2 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue