mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-03 17:35:28 +03:00
collections: grow should use the overflow-checked reserve_additional
This commit is contained in:
committed by
Alex Crichton
parent
7db691e010
commit
e7adb8434a
@@ -253,8 +253,7 @@ pub fn push_all(&mut self, other: &[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 {
|
||||
|
||||
Reference in New Issue
Block a user