]> git.lizzy.rs Git - rust.git/blob - tests/ui/filter_map_next.stderr
Auto merge of #68717 - petrochenkov:stabexpat, r=varkor
[rust.git] / tests / ui / filter_map_next.stderr
1 error: called `filter_map(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find_map(p)` instead.
2   --> $DIR/filter_map_next.rs:6:32
3    |
4 LL |     let element: Option<i32> = a.iter().filter_map(|s| s.parse().ok()).next();
5    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6    |
7    = note: `-D clippy::filter-map-next` implied by `-D warnings`
8    = note: replace `filter_map(|s| s.parse().ok()).next()` with `find_map(|s| s.parse().ok())`
9
10 error: called `filter_map(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find_map(p)` instead.
11   --> $DIR/filter_map_next.rs:10:26
12    |
13 LL |       let _: Option<u32> = vec![1, 2, 3, 4, 5, 6]
14    |  __________________________^
15 LL | |         .into_iter()
16 LL | |         .filter_map(|x| {
17 LL | |             if x == 2 {
18 ...  |
19 LL | |         })
20 LL | |         .next();
21    | |_______________^
22
23 error: aborting due to 2 previous errors
24