Skip to content

Commit 91a79e0

Browse files
committed
more doc improvements
1 parent 6b8fa5d commit 91a79e0

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

library/alloc/src/vec/mod.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ mod spec_extend;
358358
///
359359
/// `vec![x; n]`, `vec![a, b, c, d]`, and
360360
/// [`Vec::with_capacity(n)`][`Vec::with_capacity`], will all produce a `Vec`
361-
/// with exactly the requested capacity. If <code>[len] == [capacity]</code>,
361+
/// with at least the requested capacity. If <code>[len] == [capacity]</code>,
362362
/// (as is the case for the [`vec!`] macro), then a `Vec<T>` can be converted to
363363
/// and from a [`Box<[T]>`][owned slice] without reallocating or moving the elements.
364364
///
@@ -1025,8 +1025,9 @@ impl<T, A: Allocator> Vec<T, A> {
10251025
///
10261026
/// The behavior of this method depends on the allocator being used. If the allocator supports
10271027
/// in-place shrinking, some or all of the excess capacity may be returned to the allocator.
1028-
/// If not, this method may cause the vector's data to be copied to a new allocation with
1029-
/// exactly the correct size. See [`Allocator::shrink`] for more details.
1028+
/// If not, this method may cause the vector's data to be copied to a new allocation, although
1029+
/// no guarantees are given that this new allocation is actually smaller. See
1030+
/// [`Allocator::shrink`] for more details.
10301031
///
10311032
/// # Examples
10321033
///
@@ -1076,7 +1077,7 @@ impl<T, A: Allocator> Vec<T, A> {
10761077

10771078
/// Converts the vector into [`Box<[T]>`][owned slice].
10781079
///
1079-
/// Before doing the conversion, this method calls [`shrink_to_fit`] to remove excess capacity.
1080+
/// Before doing the conversion, this method discards excess capacity like [`shrink_to_fit`].
10801081
///
10811082
/// [owned slice]: Box
10821083
/// [`shrink_to_fit`]: Vec::shrink_to_fit
@@ -3290,10 +3291,12 @@ impl<T, A: Allocator> From<Box<[T], A>> for Vec<T, A> {
32903291
#[cfg(not(test))]
32913292
#[stable(feature = "box_from_vec", since = "1.20.0")]
32923293
impl<T, A: Allocator> From<Vec<T, A>> for Box<[T], A> {
3293-
/// Convert a vector into a boxed slice.
3294+
/// Converts a vector into [`Box<[T]>`][owned slice].
32943295
///
3295-
/// If `v` has excess capacity, its items will be moved into a
3296-
/// newly-allocated buffer with exactly the right capacity.
3296+
/// Before doing the conversion, this method discards excess capacity like [`Vec::shrink_to_fit`].
3297+
///
3298+
/// [owned slice]: Box
3299+
/// [`Vec::shrink_to_fit`]: Vec::shrink_to_fit
32973300
///
32983301
/// # Examples
32993302
///

0 commit comments

Comments
 (0)