From 674cd6125da1277af2d864b7d4e637c0a73f142c Mon Sep 17 00:00:00 2001 From: Nixon Enraght-Moony Date: Mon, 24 Oct 2022 15:01:58 +0100 Subject: [PATCH] Clairify Vec::capacity docs Fixes #103326 --- library/alloc/src/vec/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index 6a71f08330ca9..bbbdc3aa2a2d3 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -868,13 +868,14 @@ impl Vec { (ptr, len, capacity, alloc) } - /// Returns the number of elements the vector can hold without + /// Returns the total number of elements the vector can hold without /// reallocating. /// /// # Examples /// /// ``` - /// let vec: Vec = Vec::with_capacity(10); + /// let mut vec: Vec = Vec::with_capacity(10); + /// vec.push(42); /// assert_eq!(vec.capacity(), 10); /// ``` #[inline]