mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-14 17:07:17 +00:00
239 lines
13 KiB
Text
239 lines
13 KiB
Text
error: this expression can be written more simply using `.retain()`
|
|
--> $DIR/manual_retain.rs:25: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()`
|
|
--> $DIR/manual_retain.rs:26: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()`
|
|
--> $DIR/manual_retain.rs:27: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()`
|
|
--> $DIR/manual_retain.rs:31: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()`
|
|
--> $DIR/manual_retain.rs:32: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()`
|
|
--> $DIR/manual_retain.rs:62: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()`
|
|
--> $DIR/manual_retain.rs:63: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()`
|
|
--> $DIR/manual_retain.rs:64: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()`
|
|
--> $DIR/manual_retain.rs:89: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()`
|
|
--> $DIR/manual_retain.rs:90: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()`
|
|
--> $DIR/manual_retain.rs:91: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()`
|
|
--> $DIR/manual_retain.rs:95: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()`
|
|
--> $DIR/manual_retain.rs:96: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()`
|
|
--> $DIR/manual_retain.rs:126: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()`
|
|
--> $DIR/manual_retain.rs:127: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()`
|
|
--> $DIR/manual_retain.rs:128: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()`
|
|
--> $DIR/manual_retain.rs:152: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()`
|
|
--> $DIR/manual_retain.rs:153: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()`
|
|
--> $DIR/manual_retain.rs:154: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()`
|
|
--> $DIR/manual_retain.rs:158: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()`
|
|
--> $DIR/manual_retain.rs:159: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()`
|
|
--> $DIR/manual_retain.rs:188: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()`
|
|
--> $DIR/manual_retain.rs:200: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()`
|
|
--> $DIR/manual_retain.rs:201: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()`
|
|
--> $DIR/manual_retain.rs:202: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()`
|
|
--> $DIR/manual_retain.rs:206: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()`
|
|
--> $DIR/manual_retain.rs:207: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()`
|
|
--> $DIR/manual_retain.rs:229: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()`
|
|
--> $DIR/manual_retain.rs:230: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()`
|
|
--> $DIR/manual_retain.rs:231: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()`
|
|
--> $DIR/manual_retain.rs:288: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()`
|
|
--> $DIR/manual_retain.rs:292: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()`
|
|
--> $DIR/manual_retain.rs:309: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()`
|
|
--> $DIR/manual_retain.rs:310: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()`
|
|
--> $DIR/manual_retain.rs:311: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()`
|
|
--> $DIR/manual_retain.rs:314: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()`
|
|
--> $DIR/manual_retain.rs:315: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()`
|
|
--> $DIR/manual_retain.rs:316: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
|
|
|