diff --git a/library/alloc/src/vec.rs b/library/alloc/src/vec.rs index fcf50100fd011..2ad665f99c9a5 100644 --- a/library/alloc/src/vec.rs +++ b/library/alloc/src/vec.rs @@ -114,8 +114,9 @@ use crate::raw_vec::RawVec; /// assert_eq!(vec, [0, 0, 0, 0, 0]); /// /// // The following is equivalent, but potentially slower: -/// let mut vec1 = Vec::with_capacity(5); -/// vec1.resize(5, 0); +/// let mut vec = Vec::with_capacity(5); +/// vec.resize(5, 0); +/// assert_eq!(vec, [0, 0, 0, 0, 0]); /// ``` /// /// Use a `Vec` as an efficient stack: