Skip to content

Commit 1a41a66

Browse files
authored
Reverse condition in Vec::retain_mut doctest
1 parent c067287 commit 1a41a66

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

library/alloc/src/vec/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1470,11 +1470,11 @@ impl<T, A: Allocator> Vec<T, A> {
14701470
///
14711471
/// ```
14721472
/// let mut vec = vec![1, 2, 3, 4];
1473-
/// vec.retain_mut(|x| if *x > 3 {
1474-
/// false
1475-
/// } else {
1473+
/// vec.retain_mut(|x| if *x <= 3 {
14761474
/// *x += 1;
14771475
/// true
1476+
/// } else {
1477+
/// false
14781478
/// });
14791479
/// assert_eq!(vec, [2, 3, 4]);
14801480
/// ```

0 commit comments

Comments
 (0)