rust-clippy/tests/ui/find_map.stderr

27 lines
934 B
Text
Raw Normal View History

2020-01-24 08:04:46 +00:00
error: called `find(p).map(q)` on an `Iterator`
2019-04-27 22:06:35 +00:00
--> $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`
2020-01-25 22:01:16 +00:00
= help: this is more succinctly expressed by calling `.find_map(..)` instead
2019-04-27 22:06:35 +00:00
2020-01-24 08:04:46 +00:00
error: called `find(p).map(q)` on an `Iterator`
2019-04-27 22:06:35 +00:00
--> $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 | | });
| |__________^
2020-01-24 08:04:46 +00:00
|
2020-01-25 22:01:16 +00:00
= help: this is more succinctly expressed by calling `.find_map(..)` instead
2019-04-27 22:06:35 +00:00
error: aborting due to 2 previous errors