Skip to content

Commit

Permalink
alloc: Use intra doc links for the reserve function
Browse files Browse the repository at this point in the history
The sentence exists to highlight the existence of a
performance footgun of repeated calls of the
reserve_exact function.
  • Loading branch information
est31 committed Aug 5, 2021
1 parent 25b7648 commit 1db8737
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion library/alloc/src/collections/vec_deque/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,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 [`reserve`] if future insertions are expected.
///
/// [`reserve`]: VecDeque::reserve
///
/// # Errors
///
Expand Down
4 changes: 3 additions & 1 deletion library/alloc/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,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 [`reserve`] if future insertions are expected.
///
/// [`reserve`]: String::reserve
///
/// # Errors
///
Expand Down
8 changes: 6 additions & 2 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,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 [`reserve`] if future insertions are expected.
///
/// [`reserve`]: Vec::reserve
///
/// # Panics
///
Expand Down Expand Up @@ -875,7 +877,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 [`reserve`] if future insertions are expected.
///
/// [`reserve`]: Vec::reserve
///
/// # Errors
///
Expand Down
4 changes: 3 additions & 1 deletion library/std/src/ffi/os_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ impl OsString {
///
/// 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 [`reserve`] if future insertions are expected.
///
/// [`reserve`]: OsString::reserve
///
/// # Examples
///
Expand Down

0 comments on commit 1db8737

Please sign in to comment.