11error: this expression can be written more simply using `.retain()`
2- --> tests/ui/manual_retain.rs:27 :5
2+ --> tests/ui/manual_retain.rs:25 :5
33 |
44LL | binary_heap = binary_heap.into_iter().filter(|x| x % 2 == 0).collect();
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `binary_heap.retain(|x| x % 2 == 0)`
@@ -8,43 +8,43 @@ LL | binary_heap = binary_heap.into_iter().filter(|x| x % 2 == 0).collect();
88 = help: to override `-D warnings` add `#[allow(clippy::manual_retain)]`
99
1010error: this expression can be written more simply using `.retain()`
11- --> tests/ui/manual_retain.rs:28 :5
11+ --> tests/ui/manual_retain.rs:26 :5
1212 |
1313LL | binary_heap = binary_heap.iter().filter(|&x| x % 2 == 0).copied().collect();
1414 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `binary_heap.retain(|x| x % 2 == 0)`
1515
1616error: this expression can be written more simply using `.retain()`
17- --> tests/ui/manual_retain.rs:29 :5
17+ --> tests/ui/manual_retain.rs:27 :5
1818 |
1919LL | binary_heap = binary_heap.iter().filter(|&x| x % 2 == 0).cloned().collect();
2020 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `binary_heap.retain(|x| x % 2 == 0)`
2121
2222error: this expression can be written more simply using `.retain()`
23- --> tests/ui/manual_retain.rs:33 :5
23+ --> tests/ui/manual_retain.rs:31 :5
2424 |
2525LL | tuples = tuples.iter().filter(|(ref x, ref y)| *x == 0).copied().collect();
2626 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(ref x, ref y)| *x == 0)`
2727
2828error: this expression can be written more simply using `.retain()`
29- --> tests/ui/manual_retain.rs:34 :5
29+ --> tests/ui/manual_retain.rs:32 :5
3030 |
3131LL | tuples = tuples.iter().filter(|(x, y)| *x == 0).copied().collect();
3232 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(x, y)| *x == 0)`
3333
3434error: this expression can be written more simply using `.retain()`
35- --> tests/ui/manual_retain.rs:64 :5
35+ --> tests/ui/manual_retain.rs:62 :5
3636 |
3737LL | btree_map = btree_map.into_iter().filter(|(k, _)| k % 2 == 0).collect();
3838 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_map.retain(|k, _| k % 2 == 0)`
3939
4040error: this expression can be written more simply using `.retain()`
41- --> tests/ui/manual_retain.rs:65 :5
41+ --> tests/ui/manual_retain.rs:63 :5
4242 |
4343LL | btree_map = btree_map.into_iter().filter(|(_, v)| v % 2 == 0).collect();
4444 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_map.retain(|_, &mut v| v % 2 == 0)`
4545
4646error: this expression can be written more simply using `.retain()`
47- --> tests/ui/manual_retain.rs:66 :5
47+ --> tests/ui/manual_retain.rs:64 :5
4848 |
4949LL | / btree_map = btree_map
5050LL | | .into_iter()
@@ -53,49 +53,49 @@ LL | | .collect();
5353 | |__________________^ help: consider calling `.retain()` instead: `btree_map.retain(|k, &mut v| (k % 2 == 0) && (v % 2 == 0))`
5454
5555error: this expression can be written more simply using `.retain()`
56- --> tests/ui/manual_retain.rs:91 :5
56+ --> tests/ui/manual_retain.rs:89 :5
5757 |
5858LL | btree_set = btree_set.iter().filter(|&x| x % 2 == 0).copied().collect();
5959 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_set.retain(|x| x % 2 == 0)`
6060
6161error: this expression can be written more simply using `.retain()`
62- --> tests/ui/manual_retain.rs:92 :5
62+ --> tests/ui/manual_retain.rs:90 :5
6363 |
6464LL | btree_set = btree_set.iter().filter(|&x| x % 2 == 0).cloned().collect();
6565 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_set.retain(|x| x % 2 == 0)`
6666
6767error: this expression can be written more simply using `.retain()`
68- --> tests/ui/manual_retain.rs:93 :5
68+ --> tests/ui/manual_retain.rs:91 :5
6969 |
7070LL | btree_set = btree_set.into_iter().filter(|x| x % 2 == 0).collect();
7171 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_set.retain(|x| x % 2 == 0)`
7272
7373error: this expression can be written more simply using `.retain()`
74- --> tests/ui/manual_retain.rs:97 :5
74+ --> tests/ui/manual_retain.rs:95 :5
7575 |
7676LL | tuples = tuples.iter().filter(|(ref x, ref y)| *x == 0).copied().collect();
7777 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(ref x, ref y)| *x == 0)`
7878
7979error: this expression can be written more simply using `.retain()`
80- --> tests/ui/manual_retain.rs:98 :5
80+ --> tests/ui/manual_retain.rs:96 :5
8181 |
8282LL | tuples = tuples.iter().filter(|(x, y)| *x == 0).copied().collect();
8383 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(x, y)| *x == 0)`
8484
8585error: this expression can be written more simply using `.retain()`
86- --> tests/ui/manual_retain.rs:128 :5
86+ --> tests/ui/manual_retain.rs:126 :5
8787 |
8888LL | hash_map = hash_map.into_iter().filter(|(k, _)| k % 2 == 0).collect();
8989 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_map.retain(|k, _| k % 2 == 0)`
9090
9191error: this expression can be written more simply using `.retain()`
92- --> tests/ui/manual_retain.rs:129 :5
92+ --> tests/ui/manual_retain.rs:127 :5
9393 |
9494LL | hash_map = hash_map.into_iter().filter(|(_, v)| v % 2 == 0).collect();
9595 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_map.retain(|_, &mut v| v % 2 == 0)`
9696
9797error: this expression can be written more simply using `.retain()`
98- --> tests/ui/manual_retain.rs:130 :5
98+ --> tests/ui/manual_retain.rs:128 :5
9999 |
100100LL | / hash_map = hash_map
101101LL | | .into_iter()
@@ -104,133 +104,133 @@ LL | | .collect();
104104 | |__________________^ help: consider calling `.retain()` instead: `hash_map.retain(|k, &mut v| (k % 2 == 0) && (v % 2 == 0))`
105105
106106error: this expression can be written more simply using `.retain()`
107- --> tests/ui/manual_retain.rs:154 :5
107+ --> tests/ui/manual_retain.rs:152 :5
108108 |
109109LL | hash_set = hash_set.into_iter().filter(|x| x % 2 == 0).collect();
110110 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_set.retain(|x| x % 2 == 0)`
111111
112112error: this expression can be written more simply using `.retain()`
113- --> tests/ui/manual_retain.rs:155 :5
113+ --> tests/ui/manual_retain.rs:153 :5
114114 |
115115LL | hash_set = hash_set.iter().filter(|&x| x % 2 == 0).copied().collect();
116116 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_set.retain(|x| x % 2 == 0)`
117117
118118error: this expression can be written more simply using `.retain()`
119- --> tests/ui/manual_retain.rs:156 :5
119+ --> tests/ui/manual_retain.rs:154 :5
120120 |
121121LL | hash_set = hash_set.iter().filter(|&x| x % 2 == 0).cloned().collect();
122122 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_set.retain(|x| x % 2 == 0)`
123123
124124error: this expression can be written more simply using `.retain()`
125- --> tests/ui/manual_retain.rs:160 :5
125+ --> tests/ui/manual_retain.rs:158 :5
126126 |
127127LL | tuples = tuples.iter().filter(|(ref x, ref y)| *x == 0).copied().collect();
128128 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(ref x, ref y)| *x == 0)`
129129
130130error: this expression can be written more simply using `.retain()`
131- --> tests/ui/manual_retain.rs:161 :5
131+ --> tests/ui/manual_retain.rs:159 :5
132132 |
133133LL | tuples = tuples.iter().filter(|(x, y)| *x == 0).copied().collect();
134134 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(x, y)| *x == 0)`
135135
136136error: this expression can be written more simply using `.retain()`
137- --> tests/ui/manual_retain.rs:190 :5
137+ --> tests/ui/manual_retain.rs:188 :5
138138 |
139139LL | s = s.chars().filter(|&c| c != 'o').to_owned().collect();
140140 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `s.retain(|c| c != 'o')`
141141
142142error: this expression can be written more simply using `.retain()`
143- --> tests/ui/manual_retain.rs:202 :5
143+ --> tests/ui/manual_retain.rs:200 :5
144144 |
145145LL | vec = vec.iter().filter(|&x| x % 2 == 0).copied().collect();
146146 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| x % 2 == 0)`
147147
148148error: this expression can be written more simply using `.retain()`
149- --> tests/ui/manual_retain.rs:203 :5
149+ --> tests/ui/manual_retain.rs:201 :5
150150 |
151151LL | vec = vec.iter().filter(|&x| x % 2 == 0).cloned().collect();
152152 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| x % 2 == 0)`
153153
154154error: this expression can be written more simply using `.retain()`
155- --> tests/ui/manual_retain.rs:204 :5
155+ --> tests/ui/manual_retain.rs:202 :5
156156 |
157157LL | vec = vec.into_iter().filter(|x| x % 2 == 0).collect();
158158 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| x % 2 == 0)`
159159
160160error: this expression can be written more simply using `.retain()`
161- --> tests/ui/manual_retain.rs:208 :5
161+ --> tests/ui/manual_retain.rs:206 :5
162162 |
163163LL | tuples = tuples.iter().filter(|(ref x, ref y)| *x == 0).copied().collect();
164164 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(ref x, ref y)| *x == 0)`
165165
166166error: this expression can be written more simply using `.retain()`
167- --> tests/ui/manual_retain.rs:209 :5
167+ --> tests/ui/manual_retain.rs:207 :5
168168 |
169169LL | tuples = tuples.iter().filter(|(x, y)| *x == 0).copied().collect();
170170 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(x, y)| *x == 0)`
171171
172172error: this expression can be written more simply using `.retain()`
173- --> tests/ui/manual_retain.rs:231 :5
173+ --> tests/ui/manual_retain.rs:229 :5
174174 |
175175LL | vec_deque = vec_deque.iter().filter(|&x| x % 2 == 0).copied().collect();
176176 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec_deque.retain(|x| x % 2 == 0)`
177177
178178error: this expression can be written more simply using `.retain()`
179- --> tests/ui/manual_retain.rs:232 :5
179+ --> tests/ui/manual_retain.rs:230 :5
180180 |
181181LL | vec_deque = vec_deque.iter().filter(|&x| x % 2 == 0).cloned().collect();
182182 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec_deque.retain(|x| x % 2 == 0)`
183183
184184error: this expression can be written more simply using `.retain()`
185- --> tests/ui/manual_retain.rs:233 :5
185+ --> tests/ui/manual_retain.rs:231 :5
186186 |
187187LL | vec_deque = vec_deque.into_iter().filter(|x| x % 2 == 0).collect();
188188 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec_deque.retain(|x| x % 2 == 0)`
189189
190190error: this expression can be written more simply using `.retain()`
191- --> tests/ui/manual_retain.rs:290 :5
191+ --> tests/ui/manual_retain.rs:288 :5
192192 |
193193LL | vec = vec.into_iter().filter(|(x, y)| *x == 0).collect();
194194 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|(x, y)| *x == 0)`
195195
196196error: this expression can be written more simply using `.retain()`
197- --> tests/ui/manual_retain.rs:294 :5
197+ --> tests/ui/manual_retain.rs:292 :5
198198 |
199199LL | tuples = tuples.into_iter().filter(|(_, n)| *n > 0).collect();
200200 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(_, n)| *n > 0)`
201201
202202error: this expression can be written more simply using `.retain()`
203- --> tests/ui/manual_retain.rs:311 :5
203+ --> tests/ui/manual_retain.rs:309 :5
204204 |
205205LL | vec = vec.iter().filter(|&&x| x == 0).copied().collect();
206206 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|&x| x == 0)`
207207
208208error: this expression can be written more simply using `.retain()`
209- --> tests/ui/manual_retain.rs:312 :5
209+ --> tests/ui/manual_retain.rs:310 :5
210210 |
211211LL | vec = vec.iter().filter(|&&x| x == 0).cloned().collect();
212212 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|&x| x == 0)`
213213
214214error: this expression can be written more simply using `.retain()`
215- --> tests/ui/manual_retain.rs:313 :5
215+ --> tests/ui/manual_retain.rs:311 :5
216216 |
217217LL | vec = vec.into_iter().filter(|&x| x == 0).collect();
218218 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|&x| x == 0)`
219219
220220error: this expression can be written more simply using `.retain()`
221- --> tests/ui/manual_retain.rs:316 :5
221+ --> tests/ui/manual_retain.rs:314 :5
222222 |
223223LL | vec = vec.iter().filter(|&x| *x == 0).copied().collect();
224224 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| *x == 0)`
225225
226226error: this expression can be written more simply using `.retain()`
227- --> tests/ui/manual_retain.rs:317 :5
227+ --> tests/ui/manual_retain.rs:315 :5
228228 |
229229LL | vec = vec.iter().filter(|&x| *x == 0).cloned().collect();
230230 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| *x == 0)`
231231
232232error: this expression can be written more simply using `.retain()`
233- --> tests/ui/manual_retain.rs:318 :5
233+ --> tests/ui/manual_retain.rs:316 :5
234234 |
235235LL | vec = vec.into_iter().filter(|x| *x == 0).collect();
236236 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| *x == 0)`
0 commit comments