Skip to content

Commit 3368f5c

Browse files
authored
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`.
2 parents 6d2b885 + dbe50f5 commit 3368f5c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

library/alloc/src/collections/vec_deque.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ impl<T> VecDeque<T> {
685685
}
686686

687687
/// Tries to reserve the minimum capacity for exactly `additional` more elements to
688-
/// be inserted in the given `VecDeque<T>`. After calling `reserve_exact`,
688+
/// be inserted in the given `VecDeque<T>`. After calling `try_reserve_exact`,
689689
/// capacity will be greater than or equal to `self.len() + additional`.
690690
/// Does nothing if the capacity is already sufficient.
691691
///
@@ -727,7 +727,7 @@ impl<T> VecDeque<T> {
727727

728728
/// Tries to reserve capacity for at least `additional` more elements to be inserted
729729
/// in the given `VecDeque<T>`. The collection may reserve more space to avoid
730-
/// frequent reallocations. After calling `reserve`, capacity will be
730+
/// frequent reallocations. After calling `try_reserve`, capacity will be
731731
/// greater than or equal to `self.len() + additional`. Does nothing if
732732
/// capacity is already sufficient.
733733
///

library/alloc/src/vec.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ impl<T> Vec<T> {
523523

524524
/// Tries to reserve capacity for at least `additional` more elements to be inserted
525525
/// in the given `Vec<T>`. The collection may reserve more space to avoid
526-
/// frequent reallocations. After calling `reserve`, capacity will be
526+
/// frequent reallocations. After calling `try_reserve`, capacity will be
527527
/// greater than or equal to `self.len() + additional`. Does nothing if
528528
/// capacity is already sufficient.
529529
///
@@ -559,7 +559,7 @@ impl<T> Vec<T> {
559559
}
560560

561561
/// Tries to reserves the minimum capacity for exactly `additional` more elements to
562-
/// be inserted in the given `Vec<T>`. After calling `reserve_exact`,
562+
/// be inserted in the given `Vec<T>`. After calling `try_reserve_exact`,
563563
/// capacity will be greater than or equal to `self.len() + additional`.
564564
/// Does nothing if the capacity is already sufficient.
565565
///
@@ -582,7 +582,7 @@ impl<T> Vec<T> {
582582
/// let mut output = Vec::new();
583583
///
584584
/// // Pre-reserve the memory, exiting if we can't
585-
/// output.try_reserve(data.len())?;
585+
/// output.try_reserve_exact(data.len())?;
586586
///
587587
/// // Now we know this can't OOM in the middle of our complex work
588588
/// output.extend(data.iter().map(|&val| {

0 commit comments

Comments
 (0)