Rollup merge of #60609 - spastorino:be-explicit-on-mem-replace-doc, r=Centril

Be a bit more explicit asserting over the vec rather than the len
This commit is contained in:
Mazdak Farrokhzad 2019-05-07 19:30:11 +02:00 committed by GitHub
commit 2d6da83763
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -665,8 +665,8 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
/// let mut v: Vec<i32> = vec![1, 2];
///
/// let old_v = mem::replace(&mut v, vec![3, 4, 5]);
/// assert_eq!(2, old_v.len());
/// assert_eq!(3, v.len());
/// assert_eq!(vec![1, 2], old_v);
/// assert_eq!(vec![3, 4, 5], v);
/// ```
///
/// `replace` allows consumption of a struct field by replacing it with another value.