Skip to content

Commit

Permalink
Rollup merge of rust-lang#76058 - pickfire:patch-11, r=jyn514
Browse files Browse the repository at this point in the history
Use assertions on Vec doc

Clarify what the state of Vec after with_capacity on doc.

r? @jyn514
  • Loading branch information
matklad authored Aug 31, 2020
2 parents 9d3208a + 2d1ab83 commit c4e4e29
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions library/alloc/src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>` as an efficient stack:
Expand Down

0 comments on commit c4e4e29

Please sign in to comment.