mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 23:20:39 +00:00
239 lines
13 KiB
Text
239 lines
13 KiB
Text
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:27:5
|
|
|
|
|
LL | binary_heap = binary_heap.into_iter().filter(|x| x % 2 == 0).collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `binary_heap.retain(|x| x % 2 == 0)`
|
|
|
|
|
= note: `-D clippy::manual-retain` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::manual_retain)]`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:28:5
|
|
|
|
|
LL | binary_heap = binary_heap.iter().filter(|&x| x % 2 == 0).copied().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `binary_heap.retain(|x| x % 2 == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:29:5
|
|
|
|
|
LL | binary_heap = binary_heap.iter().filter(|&x| x % 2 == 0).cloned().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `binary_heap.retain(|x| x % 2 == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:33:5
|
|
|
|
|
LL | tuples = tuples.iter().filter(|(ref x, ref y)| *x == 0).copied().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(ref x, ref y)| *x == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:34:5
|
|
|
|
|
LL | tuples = tuples.iter().filter(|(x, y)| *x == 0).copied().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(x, y)| *x == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:64:5
|
|
|
|
|
LL | btree_map = btree_map.into_iter().filter(|(k, _)| k % 2 == 0).collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_map.retain(|k, _| k % 2 == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:65:5
|
|
|
|
|
LL | btree_map = btree_map.into_iter().filter(|(_, v)| v % 2 == 0).collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_map.retain(|_, &mut v| v % 2 == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:66:5
|
|
|
|
|
LL | / btree_map = btree_map
|
|
LL | | .into_iter()
|
|
LL | | .filter(|(k, v)| (k % 2 == 0) && (v % 2 == 0))
|
|
LL | | .collect();
|
|
| |__________________^ help: consider calling `.retain()` instead: `btree_map.retain(|k, &mut v| (k % 2 == 0) && (v % 2 == 0))`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:91:5
|
|
|
|
|
LL | btree_set = btree_set.iter().filter(|&x| x % 2 == 0).copied().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_set.retain(|x| x % 2 == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:92:5
|
|
|
|
|
LL | btree_set = btree_set.iter().filter(|&x| x % 2 == 0).cloned().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_set.retain(|x| x % 2 == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:93:5
|
|
|
|
|
LL | btree_set = btree_set.into_iter().filter(|x| x % 2 == 0).collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_set.retain(|x| x % 2 == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:97:5
|
|
|
|
|
LL | tuples = tuples.iter().filter(|(ref x, ref y)| *x == 0).copied().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(ref x, ref y)| *x == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:98:5
|
|
|
|
|
LL | tuples = tuples.iter().filter(|(x, y)| *x == 0).copied().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(x, y)| *x == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:128:5
|
|
|
|
|
LL | hash_map = hash_map.into_iter().filter(|(k, _)| k % 2 == 0).collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_map.retain(|k, _| k % 2 == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:129:5
|
|
|
|
|
LL | hash_map = hash_map.into_iter().filter(|(_, v)| v % 2 == 0).collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_map.retain(|_, &mut v| v % 2 == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:130:5
|
|
|
|
|
LL | / hash_map = hash_map
|
|
LL | | .into_iter()
|
|
LL | | .filter(|(k, v)| (k % 2 == 0) && (v % 2 == 0))
|
|
LL | | .collect();
|
|
| |__________________^ help: consider calling `.retain()` instead: `hash_map.retain(|k, &mut v| (k % 2 == 0) && (v % 2 == 0))`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:154:5
|
|
|
|
|
LL | hash_set = hash_set.into_iter().filter(|x| x % 2 == 0).collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_set.retain(|x| x % 2 == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:155:5
|
|
|
|
|
LL | hash_set = hash_set.iter().filter(|&x| x % 2 == 0).copied().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_set.retain(|x| x % 2 == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:156:5
|
|
|
|
|
LL | hash_set = hash_set.iter().filter(|&x| x % 2 == 0).cloned().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_set.retain(|x| x % 2 == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:160:5
|
|
|
|
|
LL | tuples = tuples.iter().filter(|(ref x, ref y)| *x == 0).copied().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(ref x, ref y)| *x == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:161:5
|
|
|
|
|
LL | tuples = tuples.iter().filter(|(x, y)| *x == 0).copied().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(x, y)| *x == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:190:5
|
|
|
|
|
LL | s = s.chars().filter(|&c| c != 'o').to_owned().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `s.retain(|c| c != 'o')`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:202:5
|
|
|
|
|
LL | vec = vec.iter().filter(|&x| x % 2 == 0).copied().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| x % 2 == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:203:5
|
|
|
|
|
LL | vec = vec.iter().filter(|&x| x % 2 == 0).cloned().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| x % 2 == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:204:5
|
|
|
|
|
LL | vec = vec.into_iter().filter(|x| x % 2 == 0).collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| x % 2 == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:208:5
|
|
|
|
|
LL | tuples = tuples.iter().filter(|(ref x, ref y)| *x == 0).copied().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(ref x, ref y)| *x == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:209:5
|
|
|
|
|
LL | tuples = tuples.iter().filter(|(x, y)| *x == 0).copied().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(x, y)| *x == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:231:5
|
|
|
|
|
LL | vec_deque = vec_deque.iter().filter(|&x| x % 2 == 0).copied().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec_deque.retain(|x| x % 2 == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:232:5
|
|
|
|
|
LL | vec_deque = vec_deque.iter().filter(|&x| x % 2 == 0).cloned().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec_deque.retain(|x| x % 2 == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:233:5
|
|
|
|
|
LL | vec_deque = vec_deque.into_iter().filter(|x| x % 2 == 0).collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec_deque.retain(|x| x % 2 == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:290:5
|
|
|
|
|
LL | vec = vec.into_iter().filter(|(x, y)| *x == 0).collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|(x, y)| *x == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:294:5
|
|
|
|
|
LL | tuples = tuples.into_iter().filter(|(_, n)| *n > 0).collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(_, n)| *n > 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:311:5
|
|
|
|
|
LL | vec = vec.iter().filter(|&&x| x == 0).copied().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|&x| x == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:312:5
|
|
|
|
|
LL | vec = vec.iter().filter(|&&x| x == 0).cloned().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|&x| x == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:313:5
|
|
|
|
|
LL | vec = vec.into_iter().filter(|&x| x == 0).collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|&x| x == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:316:5
|
|
|
|
|
LL | vec = vec.iter().filter(|&x| *x == 0).copied().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| *x == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:317:5
|
|
|
|
|
LL | vec = vec.iter().filter(|&x| *x == 0).cloned().collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| *x == 0)`
|
|
|
|
error: this expression can be written more simply using `.retain()`
|
|
--> tests/ui/manual_retain.rs:318:5
|
|
|
|
|
LL | vec = vec.into_iter().filter(|x| *x == 0).collect();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| *x == 0)`
|
|
|
|
error: aborting due to 38 previous errors
|
|
|