Reverse condition in Vec::retain_mut doctest

This commit is contained in:
ajtribick 2022-05-19 20:54:16 +02:00 committed by GitHub
parent c067287049
commit 1a41a665cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1470,11 +1470,11 @@ impl<T, A: Allocator> Vec<T, A> {
///
/// ```
/// let mut vec = vec![1, 2, 3, 4];
/// vec.retain_mut(|x| if *x > 3 {
/// false
/// } else {
/// vec.retain_mut(|x| if *x <= 3 {
/// *x += 1;
/// true
/// } else {
/// false
/// });
/// assert_eq!(vec, [2, 3, 4]);
/// ```