11error: 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:11 :26
2+ --> $DIR/option_map_or_none.rs:12 :26
33 |
44LL | let _: Option<i32> = opt.map_or(None, |x| Some(x + 1));
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `map` instead: `opt.map(|x| x + 1)`
66 |
77 = note: `-D clippy::option-map-or-none` implied by `-D warnings`
88
99error: 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:14 :26
10+ --> $DIR/option_map_or_none.rs:15 :26
1111 |
1212LL | let _: Option<i32> = opt.map_or(None, |x| {
1313 | __________________________^
@@ -16,13 +16,13 @@ LL | | });
1616 | |_________________________^ help: try using `map` instead: `opt.map(|x| x + 1)`
1717
1818error: 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:18 :26
19+ --> $DIR/option_map_or_none.rs:19 :26
2020 |
2121LL | let _: Option<i32> = opt.map_or(None, bar);
2222 | ^^^^^^^^^^^^^^^^^^^^^ help: try using `and_then` instead: `opt.and_then(bar)`
2323
2424error: 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:19 :26
25+ --> $DIR/option_map_or_none.rs:20 :26
2626 |
2727LL | let _: Option<i32> = opt.map_or(None, |x| {
2828 | __________________________^
@@ -41,5 +41,13 @@ LL + Some(offset + height)
4141LL ~ });
4242 |
4343
44- error: aborting due to 4 previous errors
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
4553
0 commit comments