diff options
| author | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2014-07-03 08:40:08 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-07-03 12:54:52 -0700 |
| commit | e7adb8434aed78b1b5b4bb01c45f680a4b8adebb (patch) | |
| tree | 7160ec90c9191e6a0061ecdb118df97a058c6059 /src/libcollections/vec.rs | |
| parent | 7db691e010c34d156ff31eda2db0560738c45837 (diff) | |
| download | rust-e7adb8434aed78b1b5b4bb01c45f680a4b8adebb.tar.gz rust-e7adb8434aed78b1b5b4bb01c45f680a4b8adebb.zip | |
collections: grow should use the overflow-checked reserve_additional
Diffstat (limited to 'src/libcollections/vec.rs')
| -rw-r--r-- | src/libcollections/vec.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 2ffc168f82c..b8efaa78af3 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -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 { |
