2022-06-30 03:50:09 -05:00
|
|
|
error: manual implementation of `Iterator::find`
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/manual_find_fixable.rs:10:5
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
LL | / for &v in ARRAY {
|
|
|
|
LL | | if v == n {
|
|
|
|
LL | | return Some(v);
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
LL | | None
|
|
|
|
| |________^ help: replace with an iterator: `ARRAY.iter().find(|&&v| v == n).copied()`
|
|
|
|
|
|
|
|
|
= note: `-D clippy::manual-find` implied by `-D warnings`
|
|
|
|
|
|
|
|
error: manual implementation of `Iterator::find`
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/manual_find_fixable.rs:19:5
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
LL | / for (a, _) in arr {
|
|
|
|
LL | | if a % 2 == 0 {
|
|
|
|
LL | | return Some(a);
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
LL | | None
|
|
|
|
| |________^ help: replace with an iterator: `arr.into_iter().map(|(a, _)| a).find(|&a| a % 2 == 0)`
|
|
|
|
|
|
|
|
error: manual implementation of `Iterator::find`
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/manual_find_fixable.rs:32:5
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
LL | / for el in arr {
|
|
|
|
LL | | if el.name.len() == 10 {
|
|
|
|
LL | | return Some(el);
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
LL | | None
|
|
|
|
| |________^ help: replace with an iterator: `arr.into_iter().find(|el| el.name.len() == 10)`
|
|
|
|
|
|
|
|
|
= note: you may need to dereference some variables
|
|
|
|
|
|
|
|
error: manual implementation of `Iterator::find`
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/manual_find_fixable.rs:42:5
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
LL | / for Tuple(a, _) in arr {
|
|
|
|
LL | | if a >= 3 {
|
|
|
|
LL | | return Some(a);
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
LL | | None
|
|
|
|
| |________^ help: replace with an iterator: `arr.into_iter().map(|Tuple(a, _)| a).find(|&a| a >= 3)`
|
|
|
|
|
|
|
|
error: manual implementation of `Iterator::find`
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/manual_find_fixable.rs:57:5
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
LL | / for el in arr {
|
|
|
|
LL | | if el.should_keep() {
|
|
|
|
LL | | return Some(el);
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
LL | | None
|
|
|
|
| |________^ help: replace with an iterator: `arr.into_iter().find(|el| el.should_keep())`
|
|
|
|
|
|
|
|
|
= note: you may need to dereference some variables
|
|
|
|
|
|
|
|
error: manual implementation of `Iterator::find`
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/manual_find_fixable.rs:67:5
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
LL | / for el in arr {
|
|
|
|
LL | | if f(el) == 20 {
|
|
|
|
LL | | return Some(el);
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
LL | | None
|
|
|
|
| |________^ help: replace with an iterator: `arr.into_iter().find(|&el| f(el) == 20)`
|
|
|
|
|
|
|
|
error: manual implementation of `Iterator::find`
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/manual_find_fixable.rs:77:5
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
LL | / for &el in arr.values() {
|
|
|
|
LL | | if f(el) {
|
|
|
|
LL | | return Some(el);
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
LL | | None
|
|
|
|
| |________^ help: replace with an iterator: `arr.values().find(|&&el| f(el)).copied()`
|
|
|
|
|
|
|
|
error: manual implementation of `Iterator::find`
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/manual_find_fixable.rs:86:5
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
LL | / for el in arr {
|
|
|
|
LL | | if el.is_true {
|
|
|
|
LL | | return Some(el);
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
LL | | None
|
|
|
|
| |________^ help: replace with an iterator: `arr.into_iter().find(|el| el.is_true)`
|
|
|
|
|
|
|
|
|
= note: you may need to dereference some variables
|
|
|
|
|
|
|
|
error: manual implementation of `Iterator::find`
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/manual_find_fixable.rs:116:5
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
LL | / for (_, &x) in v {
|
|
|
|
LL | | if x > 10 {
|
|
|
|
LL | | return Some(x);
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
LL | | None
|
|
|
|
| |________^ help: replace with an iterator: `v.into_iter().map(|(_, &x)| x).find(|&x| x > 10)`
|
|
|
|
|
|
|
|
error: manual implementation of `Iterator::find`
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/manual_find_fixable.rs:125:5
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
LL | / for &(_, &x) in v {
|
|
|
|
LL | | if x > 10 {
|
|
|
|
LL | | return Some(x);
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
LL | | None
|
|
|
|
| |________^ help: replace with an iterator: `v.iter().map(|&(_, &x)| x).find(|&x| x > 10)`
|
|
|
|
|
|
|
|
error: manual implementation of `Iterator::find`
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/manual_find_fixable.rs:134:5
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
LL | / for x in arr {
|
|
|
|
LL | | if x >= 5 {
|
|
|
|
LL | | return Some(x);
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
LL | | return None;
|
|
|
|
| |________________^ help: replace with an iterator: `arr.into_iter().find(|&x| x >= 5)`
|
|
|
|
|
|
|
|
error: manual implementation of `Iterator::find`
|
2023-08-24 14:32:12 -05:00
|
|
|
--> $DIR/manual_find_fixable.rs:189:9
|
2022-06-30 03:50:09 -05:00
|
|
|
|
|
|
|
|
LL | / for x in arr {
|
|
|
|
LL | | if x < 1 {
|
|
|
|
LL | | return Some(x);
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
LL | | None
|
|
|
|
| |____________^ help: replace with an iterator: `arr.into_iter().find(|&x| x < 1)`
|
|
|
|
|
|
|
|
error: aborting due to 12 previous errors
|
|
|
|
|