Skip to content

Commit 1db8737

Browse files
committed
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.
1 parent 25b7648 commit 1db8737

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

library/alloc/src/collections/vec_deque/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,9 @@ impl<T, A: Allocator> VecDeque<T, A> {
697697
///
698698
/// Note that the allocator may give the collection more space than it
699699
/// requests. Therefore, capacity can not be relied upon to be precisely
700-
/// minimal. Prefer `reserve` if future insertions are expected.
700+
/// minimal. Prefer [`reserve`] if future insertions are expected.
701+
///
702+
/// [`reserve`]: VecDeque::reserve
701703
///
702704
/// # Errors
703705
///

library/alloc/src/string.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,9 @@ impl String {
10351035
///
10361036
/// Note that the allocator may give the collection more space than it
10371037
/// requests. Therefore, capacity can not be relied upon to be precisely
1038-
/// minimal. Prefer `reserve` if future insertions are expected.
1038+
/// minimal. Prefer [`reserve`] if future insertions are expected.
1039+
///
1040+
/// [`reserve`]: String::reserve
10391041
///
10401042
/// # Errors
10411043
///

library/alloc/src/vec/mod.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,9 @@ impl<T, A: Allocator> Vec<T, A> {
811811
///
812812
/// Note that the allocator may give the collection more space than it
813813
/// requests. Therefore, capacity can not be relied upon to be precisely
814-
/// minimal. Prefer `reserve` if future insertions are expected.
814+
/// minimal. Prefer [`reserve`] if future insertions are expected.
815+
///
816+
/// [`reserve`]: Vec::reserve
815817
///
816818
/// # Panics
817819
///
@@ -875,7 +877,9 @@ impl<T, A: Allocator> Vec<T, A> {
875877
///
876878
/// Note that the allocator may give the collection more space than it
877879
/// requests. Therefore, capacity can not be relied upon to be precisely
878-
/// minimal. Prefer `reserve` if future insertions are expected.
880+
/// minimal. Prefer [`reserve`] if future insertions are expected.
881+
///
882+
/// [`reserve`]: Vec::reserve
879883
///
880884
/// # Errors
881885
///

library/std/src/ffi/os_str.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,9 @@ impl OsString {
271271
///
272272
/// Note that the allocator may give the collection more space than it
273273
/// requests. Therefore, capacity can not be relied upon to be precisely
274-
/// minimal. Prefer reserve if future insertions are expected.
274+
/// minimal. Prefer [`reserve`] if future insertions are expected.
275+
///
276+
/// [`reserve`]: OsString::reserve
275277
///
276278
/// # Examples
277279
///

0 commit comments

Comments
 (0)