From b67006422e38ba68eec97f2ce249c9d885ea9270 Mon Sep 17 00:00:00 2001 From: Anton Date: Wed, 2 Sep 2020 13:12:44 +0200 Subject: [PATCH 1/2] 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`. --- library/alloc/src/vec.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/alloc/src/vec.rs b/library/alloc/src/vec.rs index c86798a1bd3a5..27eefb0584216 100644 --- a/library/alloc/src/vec.rs +++ b/library/alloc/src/vec.rs @@ -523,7 +523,7 @@ impl Vec { /// Tries to reserve capacity for at least `additional` more elements to be inserted /// in the given `Vec`. 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 Vec { } /// Tries to reserves the minimum capacity for exactly `additional` more elements to - /// be inserted in the given `Vec`. After calling `reserve_exact`, + /// be inserted in the given `Vec`. 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 Vec { /// 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| { From dbe50f5c24547c64f377bf727b55982dbceda80c Mon Sep 17 00:00:00 2001 From: Anton Date: Wed, 2 Sep 2020 14:09:42 +0200 Subject: [PATCH 2/2] Same typos in vec_deque --- library/alloc/src/collections/vec_deque.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/alloc/src/collections/vec_deque.rs b/library/alloc/src/collections/vec_deque.rs index a4c6ccd6cb0d4..52b9f73ba8825 100644 --- a/library/alloc/src/collections/vec_deque.rs +++ b/library/alloc/src/collections/vec_deque.rs @@ -685,7 +685,7 @@ impl VecDeque { } /// Tries to reserve the minimum capacity for exactly `additional` more elements to - /// be inserted in the given `VecDeque`. After calling `reserve_exact`, + /// be inserted in the given `VecDeque`. 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 VecDeque { /// Tries to reserve capacity for at least `additional` more elements to be inserted /// in the given `VecDeque`. 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. ///