Skip to content

Commit 6425764

Browse files
Rollup merge of rust-lang#103719 - joseluis:fix-typos-try-reserve, r=the8472
fix typo in `try_reserve` method from `HashMap` and `HashSet` Currently refers to the `reserve` method, instead of `try_reserve`. Other collections like [Vec](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.try_reserve) & [VecDeque](https://doc.rust-lang.org/std/collections/vec_deque/struct.VecDeque.html#method.try_reserve) shows it well.
2 parents 679771f + 4b35313 commit 6425764

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

library/std/src/collections/hash/map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ where
759759

760760
/// Tries to reserve capacity for at least `additional` more elements to be inserted
761761
/// in the `HashMap`. The collection may reserve more space to speculatively
762-
/// avoid frequent reallocations. After calling `reserve`,
762+
/// avoid frequent reallocations. After calling `try_reserve`,
763763
/// capacity will be greater than or equal to `self.len() + additional` if
764764
/// it returns `Ok(())`.
765765
/// Does nothing if capacity is already sufficient.

library/std/src/collections/hash/set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ where
462462

463463
/// Tries to reserve capacity for at least `additional` more elements to be inserted
464464
/// in the `HashSet`. The collection may reserve more space to speculatively
465-
/// avoid frequent reallocations. After calling `reserve`,
465+
/// avoid frequent reallocations. After calling `try_reserve`,
466466
/// capacity will be greater than or equal to `self.len() + additional` if
467467
/// it returns `Ok(())`.
468468
/// Does nothing if capacity is already sufficient.

0 commit comments

Comments
 (0)