diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-09-03 02:22:13 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-03 02:22:13 +0200 |
| commit | 3368f5c820f5fc1700eb22ea2ed45fa057eab83a (patch) | |
| tree | b766f1fb6f5dc2dec980598726945924cb4f128f | |
| parent | 6d2b885112f991149476df7a30359abb91374113 (diff) | |
| parent | dbe50f5c24547c64f377bf727b55982dbceda80c (diff) | |
| download | rust-3368f5c820f5fc1700eb22ea2ed45fa057eab83a.tar.gz rust-3368f5c820f5fc1700eb22ea2ed45fa057eab83a.zip | |
Rollup merge of #76243 - ama0:patch-1, r=jonas-schievink
Fix typos in vec try_reserve(_exact) docs `try_reserve` and `try_reserve_exact` docs refer to calling `reserve` and `reserve_exact`. `try_reserve_exact` example uses `try_reserve` method instead of `try_reserve_exact`.
| -rw-r--r-- | library/alloc/src/collections/vec_deque.rs | 4 | ||||
| -rw-r--r-- | library/alloc/src/vec.rs | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/library/alloc/src/collections/vec_deque.rs b/library/alloc/src/collections/vec_deque.rs index a4c6ccd6cb0..52b9f73ba88 100644 --- a/library/alloc/src/collections/vec_deque.rs +++ b/library/alloc/src/collections/vec_deque.rs @@ -685,7 +685,7 @@ impl<T> VecDeque<T> { } /// Tries to reserve the minimum capacity for exactly `additional` more elements to - /// be inserted in the given `VecDeque<T>`. After calling `reserve_exact`, + /// be inserted in the given `VecDeque<T>`. After calling `try_reserve_exact`, /// capacity will be greater than or equal to `self.len() + additional`. /// Does nothing if the capacity is already sufficient. /// @@ -727,7 +727,7 @@ impl<T> VecDeque<T> { /// Tries to reserve capacity for at least `additional` more elements to be inserted /// in the given `VecDeque<T>`. The collection may reserve more space to avoid - /// frequent reallocations. After calling `reserve`, capacity will be + /// frequent reallocations. After calling `try_reserve`, capacity will be /// greater than or equal to `self.len() + additional`. Does nothing if /// capacity is already sufficient. /// diff --git a/library/alloc/src/vec.rs b/library/alloc/src/vec.rs index c86798a1bd3..27eefb05842 100644 --- a/library/alloc/src/vec.rs +++ b/library/alloc/src/vec.rs @@ -523,7 +523,7 @@ impl<T> Vec<T> { /// Tries to reserve capacity for at least `additional` more elements to be inserted /// in the given `Vec<T>`. The collection may reserve more space to avoid - /// frequent reallocations. After calling `reserve`, capacity will be + /// frequent reallocations. After calling `try_reserve`, capacity will be /// greater than or equal to `self.len() + additional`. Does nothing if /// capacity is already sufficient. /// @@ -559,7 +559,7 @@ impl<T> Vec<T> { } /// Tries to reserves the minimum capacity for exactly `additional` more elements to - /// be inserted in the given `Vec<T>`. After calling `reserve_exact`, + /// be inserted in the given `Vec<T>`. After calling `try_reserve_exact`, /// capacity will be greater than or equal to `self.len() + additional`. /// Does nothing if the capacity is already sufficient. /// @@ -582,7 +582,7 @@ impl<T> Vec<T> { /// let mut output = Vec::new(); /// /// // Pre-reserve the memory, exiting if we can't - /// output.try_reserve(data.len())?; + /// output.try_reserve_exact(data.len())?; /// /// // Now we know this can't OOM in the middle of our complex work /// output.extend(data.iter().map(|&val| { |
