Rollup merge of #91547 - TennyZhuang:suggest_try_reserve, r=scottmcm

Suggest try_reserve in try_reserve_exact

During developing #91529 , I found that `try_reserve_exact` suggests `reserve` for further insertions. I think it's a mistake by copy&paste, `try_reserve` is better here.
This commit is contained in:
Matthias Krüger 2021-12-07 11:05:04 +01:00 committed by GitHub
commit 1c2fba6540
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -720,9 +720,9 @@ impl<T, A: Allocator> VecDeque<T, A> {
///
/// Note that the allocator may give the collection more space than it
/// requests. Therefore, capacity can not be relied upon to be precisely
/// minimal. Prefer [`reserve`] if future insertions are expected.
/// minimal. Prefer [`try_reserve`] if future insertions are expected.
///
/// [`reserve`]: VecDeque::reserve
/// [`try_reserve`]: VecDeque::try_reserve
///
/// # Errors
///

View File

@ -1044,9 +1044,9 @@ impl String {
///
/// Note that the allocator may give the collection more space than it
/// requests. Therefore, capacity can not be relied upon to be precisely
/// minimal. Prefer [`reserve`] if future insertions are expected.
/// minimal. Prefer [`try_reserve`] if future insertions are expected.
///
/// [`reserve`]: String::reserve
/// [`try_reserve`]: String::try_reserve
///
/// # Errors
///

View File

@ -881,9 +881,9 @@ impl<T, A: Allocator> Vec<T, A> {
///
/// Note that the allocator may give the collection more space than it
/// requests. Therefore, capacity can not be relied upon to be precisely
/// minimal. Prefer [`reserve`] if future insertions are expected.
/// minimal. Prefer [`try_reserve`] if future insertions are expected.
///
/// [`reserve`]: Vec::reserve
/// [`try_reserve`]: Vec::try_reserve
///
/// # Errors
///