Skip to content

Commit

Permalink
Rollup merge of rust-lang#87780 - est31:intra_doc_links, r=jyn514
Browse files Browse the repository at this point in the history
alloc: Use intra doc links for the reserve function

The sentence exists to highlight the existence of a
performance footgun of repeated calls of the
reserve_exact function.
  • Loading branch information
JohnTitor authored Aug 6, 2021
2 parents 7353e2f + 1db8737 commit 0b3a5b0
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 0b3a5b0

Please sign in to comment.