]> git.lizzy.rs Git - rust.git/blob - tests/ui/option_map_or_none.stderr
Auto merge of #8374 - Alexendoo:bless-revisions, r=camsteffen
[rust.git] / tests / ui / option_map_or_none.stderr
1 error: called `map_or(None, ..)` on an `Option` value. This can be done more directly by calling `map(..)` instead
2   --> $DIR/option_map_or_none.rs:12:26
3    |
4 LL |     let _: Option<i32> = opt.map_or(None, |x| Some(x + 1));
5    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `map` instead: `opt.map(|x| x + 1)`
6    |
7    = note: `-D clippy::option-map-or-none` implied by `-D warnings`
8
9 error: called `map_or(None, ..)` on an `Option` value. This can be done more directly by calling `map(..)` instead
10   --> $DIR/option_map_or_none.rs:15:26
11    |
12 LL |       let _: Option<i32> = opt.map_or(None, |x| {
13    |  __________________________^
14 LL | |                         Some(x + 1)
15 LL | |                        });
16    | |_________________________^ help: try using `map` instead: `opt.map(|x| x + 1)`
17
18 error: called `map_or(None, ..)` on an `Option` value. This can be done more directly by calling `and_then(..)` instead
19   --> $DIR/option_map_or_none.rs:19:26
20    |
21 LL |     let _: Option<i32> = opt.map_or(None, bar);
22    |                          ^^^^^^^^^^^^^^^^^^^^^ help: try using `and_then` instead: `opt.and_then(bar)`
23
24 error: called `map_or(None, ..)` on an `Option` value. This can be done more directly by calling `and_then(..)` instead
25   --> $DIR/option_map_or_none.rs:20:26
26    |
27 LL |       let _: Option<i32> = opt.map_or(None, |x| {
28    |  __________________________^
29 LL | |         let offset = 0;
30 LL | |         let height = x;
31 LL | |         Some(offset + height)
32 LL | |     });
33    | |______^
34    |
35 help: try using `and_then` instead
36    |
37 LL ~     let _: Option<i32> = opt.and_then(|x| {
38 LL +         let offset = 0;
39 LL +         let height = x;
40 LL +         Some(offset + height)
41 LL ~     });
42    |
43
44 error: called `map_or(None, Some)` on a `Result` value. This can be done more directly by calling `ok()` instead
45   --> $DIR/option_map_or_none.rs:27:26
46    |
47 LL |     let _: Option<i32> = r.map_or(None, Some);
48    |                          ^^^^^^^^^^^^^^^^^^^^ help: try using `ok` instead: `r.ok()`
49    |
50    = note: `-D clippy::result-map-or-into-option` implied by `-D warnings`
51
52 error: aborting due to 5 previous errors
53