Rollup merge of #76058 - pickfire:patch-11, r=jyn514

Use assertions on Vec doc

Clarify what the state of Vec after with_capacity on doc.

r? @jyn514
This commit is contained in:
Aleksey Kladov 2020-08-31 12:51:51 +02:00 committed by GitHub
commit d829a5bcb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: