Skip to content

Commit b670064

Browse files
authored
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`.
1 parent da897df commit b670064

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

library/alloc/src/vec.rs

Lines changed: 3 additions & 3 deletions
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)