Skip to content

Commit 674cd61

Browse files
committed
Clairify Vec::capacity docs
Fixes #103326
1 parent 1481fd9 commit 674cd61

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

library/alloc/src/vec/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -868,13 +868,14 @@ impl<T, A: Allocator> Vec<T, A> {
868868
(ptr, len, capacity, alloc)
869869
}
870870

871-
/// Returns the number of elements the vector can hold without
871+
/// Returns the total number of elements the vector can hold without
872872
/// reallocating.
873873
///
874874
/// # Examples
875875
///
876876
/// ```
877-
/// let vec: Vec<i32> = Vec::with_capacity(10);
877+
/// let mut vec: Vec<i32> = Vec::with_capacity(10);
878+
/// vec.push(42);
878879
/// assert_eq!(vec.capacity(), 10);
879880
/// ```
880881
#[inline]

0 commit comments

Comments
 (0)