mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-22 19:13:29 +00:00
24 lines
911 B
Text
24 lines
911 B
Text
|
error: called `find(p).map(q)` on an `Iterator`. This is more succinctly expressed by calling `.find_map(..)` instead.
|
||
|
--> $DIR/find_map.rs:20:26
|
||
|
|
|
||
|
LL | let _: Option<i32> = a.iter().find(|s| s.parse::<i32>().is_ok()).map(|s| s.parse().unwrap());
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
|
|
|
||
|
= note: `-D clippy::find-map` implied by `-D warnings`
|
||
|
|
||
|
error: called `find(p).map(q)` on an `Iterator`. This is more succinctly expressed by calling `.find_map(..)` instead.
|
||
|
--> $DIR/find_map.rs:22:29
|
||
|
|
|
||
|
LL | let _: Option<Flavor> = desserts_of_the_week
|
||
|
| _____________________________^
|
||
|
LL | | .iter()
|
||
|
LL | | .find(|dessert| match *dessert {
|
||
|
LL | | Dessert::Cake(_) => true,
|
||
|
... |
|
||
|
LL | | _ => unreachable!(),
|
||
|
LL | | });
|
||
|
| |__________^
|
||
|
|
||
|
error: aborting due to 2 previous errors
|
||
|
|