Skip to content

Commit 43985d9

Browse files
authored
Rollup merge of #59984 - gluyas:collections-with_capacity-doc-fix, r=rkruppe
Remove collection-specific `with_capacity` documentation from `std::collections` Fixes #59931 The style of `std::collections` module doc is very much a beginner friendly guide, and documenting niche, collection-specific behaviour feels out of place, if not brittle. The note about `VecDeque` is outdated (see issue), and while `Vec` probably won't change its guarantees any time soon, the users who are interested in its allocation properties will find that in its own documentation.
2 parents a204387 + 64dc041 commit 43985d9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/libstd/collections/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,9 @@
150150
//! Any `with_capacity` constructor will instruct the collection to allocate
151151
//! enough space for the specified number of elements. Ideally this will be for
152152
//! exactly that many elements, but some implementation details may prevent
153-
//! this. [`Vec`] and [`VecDeque`] can be relied on to allocate exactly the
154-
//! requested amount, though. Use `with_capacity` when you know exactly how many
155-
//! elements will be inserted, or at least have a reasonable upper-bound on that
156-
//! number.
153+
//! this. See collection-specific documentation for details. In general, use
154+
//! `with_capacity` when you know exactly how many elements will be inserted, or
155+
//! at least have a reasonable upper-bound on that number.
157156
//!
158157
//! When anticipating a large influx of elements, the `reserve` family of
159158
//! methods can be used to hint to the collection how much room it should make

0 commit comments

Comments
 (0)