diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-12-07 11:05:04 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-07 11:05:04 +0100 |
| commit | 1c2fba65406e1d901194ec4c2c3162ba10e45f5b (patch) | |
| tree | df24541c76b0abf3cdf69dd2c1492444c8d898c4 | |
| parent | a8f47dc7aa237b074f718c446b040e86ac633b17 (diff) | |
| parent | aa3370c92be12d04db6a99c92044c56d453f94df (diff) | |
| download | rust-1c2fba65406e1d901194ec4c2c3162ba10e45f5b.tar.gz rust-1c2fba65406e1d901194ec4c2c3162ba10e45f5b.zip | |
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.
| -rw-r--r-- | library/alloc/src/collections/vec_deque/mod.rs | 4 | ||||
| -rw-r--r-- | library/alloc/src/string.rs | 4 | ||||
| -rw-r--r-- | library/alloc/src/vec/mod.rs | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/library/alloc/src/collections/vec_deque/mod.rs b/library/alloc/src/collections/vec_deque/mod.rs index 42eae6a54b5..702d97858eb 100644 --- a/library/alloc/src/collections/vec_deque/mod.rs +++ b/library/alloc/src/collections/vec_deque/mod.rs @@ -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 /// diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index 4f926d99c6d..b151842458d 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -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 /// diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index 88bde6e8ce4..f1b70fa2802 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -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 /// |
