11error: this expression can be written more simply using `.retain()`
2- --> $DIR/use_retain.rs:45 :5
2+ --> $DIR/use_retain.rs:47 :5
33 |
44LL | btree_map = btree_map.into_iter().filter(|(k, _)| k % 2 == 0).collect();
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_map.retain(|k, _| k % 2 == 0)`
66 |
77 = note: `-D clippy::use-retain` implied by `-D warnings`
88
99error: this expression can be written more simply using `.retain()`
10- --> $DIR/use_retain.rs:46 :5
10+ --> $DIR/use_retain.rs:48 :5
1111 |
1212LL | btree_map = btree_map.into_iter().filter(|(_, v)| v % 2 == 0).collect();
1313 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_map.retain(|_, &mut v| v % 2 == 0)`
1414
1515error: this expression can be written more simply using `.retain()`
16- --> $DIR/use_retain.rs:47 :5
16+ --> $DIR/use_retain.rs:49 :5
1717 |
1818LL | / btree_map = btree_map
1919LL | | .into_iter()
@@ -22,31 +22,37 @@ LL | | .collect();
2222 | |__________________^ help: consider calling `.retain()` instead: `btree_map.retain(|k, &mut v| (k % 2 == 0) && (v % 2 == 0))`
2323
2424error: this expression can be written more simply using `.retain()`
25- --> $DIR/use_retain.rs:69 :5
25+ --> $DIR/use_retain.rs:71 :5
2626 |
2727LL | btree_set = btree_set.iter().filter(|&x| x % 2 == 0).copied().collect();
2828 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_set.retain(|x| x % 2 == 0)`
2929
3030error: this expression can be written more simply using `.retain()`
31- --> $DIR/use_retain.rs:70:5
31+ --> $DIR/use_retain.rs:72:5
32+ |
33+ LL | btree_set = btree_set.iter().filter(|&x| x % 2 == 0).cloned().collect();
34+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_set.retain(|x| x % 2 == 0)`
35+
36+ error: this expression can be written more simply using `.retain()`
37+ --> $DIR/use_retain.rs:73:5
3238 |
3339LL | btree_set = btree_set.into_iter().filter(|x| x % 2 == 0).collect();
3440 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_set.retain(|x| x % 2 == 0)`
3541
3642error: this expression can be written more simply using `.retain()`
37- --> $DIR/use_retain.rs:93 :5
43+ --> $DIR/use_retain.rs:103 :5
3844 |
3945LL | hash_map = hash_map.into_iter().filter(|(k, _)| k % 2 == 0).collect();
4046 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_map.retain(|k, _| k % 2 == 0)`
4147
4248error: this expression can be written more simply using `.retain()`
43- --> $DIR/use_retain.rs:94 :5
49+ --> $DIR/use_retain.rs:104 :5
4450 |
4551LL | hash_map = hash_map.into_iter().filter(|(_, v)| v % 2 == 0).collect();
4652 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_map.retain(|_, &mut v| v % 2 == 0)`
4753
4854error: this expression can be written more simply using `.retain()`
49- --> $DIR/use_retain.rs:95 :5
55+ --> $DIR/use_retain.rs:105 :5
5056 |
5157LL | / hash_map = hash_map
5258LL | | .into_iter()
@@ -55,46 +61,64 @@ LL | | .collect();
5561 | |__________________^ help: consider calling `.retain()` instead: `hash_map.retain(|k, &mut v| (k % 2 == 0) && (v % 2 == 0))`
5662
5763error: this expression can be written more simply using `.retain()`
58- --> $DIR/use_retain.rs:116 :5
64+ --> $DIR/use_retain.rs:126 :5
5965 |
6066LL | hash_set = hash_set.into_iter().filter(|x| x % 2 == 0).collect();
6167 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_set.retain(|x| x % 2 == 0)`
6268
6369error: this expression can be written more simply using `.retain()`
64- --> $DIR/use_retain.rs:117 :5
70+ --> $DIR/use_retain.rs:127 :5
6571 |
6672LL | hash_set = hash_set.iter().filter(|&x| x % 2 == 0).copied().collect();
6773 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_set.retain(|x| x % 2 == 0)`
6874
6975error: this expression can be written more simply using `.retain()`
70- --> $DIR/use_retain.rs:139:5
76+ --> $DIR/use_retain.rs:128:5
77+ |
78+ LL | hash_set = hash_set.iter().filter(|&x| x % 2 == 0).cloned().collect();
79+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_set.retain(|x| x % 2 == 0)`
80+
81+ error: this expression can be written more simply using `.retain()`
82+ --> $DIR/use_retain.rs:157:5
7183 |
7284LL | s = s.chars().filter(|&c| c != 'o').to_owned().collect();
7385 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `s.retain(|c| c != 'o')`
7486
7587error: this expression can be written more simply using `.retain()`
76- --> $DIR/use_retain.rs:151 :5
88+ --> $DIR/use_retain.rs:169 :5
7789 |
7890LL | vec = vec.iter().filter(|&x| x % 2 == 0).copied().collect();
7991 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| x % 2 == 0)`
8092
8193error: this expression can be written more simply using `.retain()`
82- --> $DIR/use_retain.rs:152:5
94+ --> $DIR/use_retain.rs:170:5
95+ |
96+ LL | vec = vec.iter().filter(|&x| x % 2 == 0).cloned().collect();
97+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| x % 2 == 0)`
98+
99+ error: this expression can be written more simply using `.retain()`
100+ --> $DIR/use_retain.rs:171:5
83101 |
84102LL | vec = vec.into_iter().filter(|x| x % 2 == 0).collect();
85103 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| x % 2 == 0)`
86104
87105error: this expression can be written more simply using `.retain()`
88- --> $DIR/use_retain.rs:172 :5
106+ --> $DIR/use_retain.rs:193 :5
89107 |
90108LL | vec_deque = vec_deque.iter().filter(|&x| x % 2 == 0).copied().collect();
91109 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec_deque.retain(|x| x % 2 == 0)`
92110
93111error: this expression can be written more simply using `.retain()`
94- --> $DIR/use_retain.rs:173:5
112+ --> $DIR/use_retain.rs:194:5
113+ |
114+ LL | vec_deque = vec_deque.iter().filter(|&x| x % 2 == 0).cloned().collect();
115+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec_deque.retain(|x| x % 2 == 0)`
116+
117+ error: this expression can be written more simply using `.retain()`
118+ --> $DIR/use_retain.rs:195:5
95119 |
96120LL | vec_deque = vec_deque.into_iter().filter(|x| x % 2 == 0).collect();
97121 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec_deque.retain(|x| x % 2 == 0)`
98122
99- error: aborting due to 15 previous errors
123+ error: aborting due to 19 previous errors
100124
0 commit comments