mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-19 18:34:08 +00:00
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:
commit
2d6da83763
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user