]> git.lizzy.rs Git - rust.git/blob - tests/ui/option_map_or_none.stderr
Auto merge of #4478 - tsurai:master, r=flip1995
[rust.git] / tests / ui / option_map_or_none.stderr
1 error: called `map_or(None, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead
2   --> $DIR/option_map_or_none.rs:10:13
3    |
4 LL |     let _ = opt.map_or(None, |x| Some(x + 1));
5    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using and_then instead: `opt.and_then(|x| Some(x + 1))`
6    |
7    = note: `-D clippy::option-map-or-none` implied by `-D warnings`
8
9 error: called `map_or(None, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead
10   --> $DIR/option_map_or_none.rs:13:13
11    |
12 LL |       let _ = opt.map_or(None, |x| {
13    |  _____________^
14 LL | |                         Some(x + 1)
15 LL | |                        });
16    | |_________________________^
17 help: try using and_then instead
18    |
19 LL |     let _ = opt.and_then(|x| {
20 LL |                         Some(x + 1)
21 LL |                        });
22    |
23
24 error: aborting due to 2 previous errors
25