1
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:11 :26
2
+ --> $DIR/option_map_or_none.rs:12 :26
3
3
|
4
4
LL | let _: Option<i32> = opt.map_or(None, |x| Some(x + 1));
5
5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `map` instead: `opt.map(|x| x + 1)`
6
6
|
7
7
= note: `-D clippy::option-map-or-none` implied by `-D warnings`
8
8
9
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:14 :26
10
+ --> $DIR/option_map_or_none.rs:15 :26
11
11
|
12
12
LL | let _: Option<i32> = opt.map_or(None, |x| {
13
13
| __________________________^
@@ -16,13 +16,13 @@ LL | | });
16
16
| |_________________________^ help: try using `map` instead: `opt.map(|x| x + 1)`
17
17
18
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:18 :26
19
+ --> $DIR/option_map_or_none.rs:19 :26
20
20
|
21
21
LL | let _: Option<i32> = opt.map_or(None, bar);
22
22
| ^^^^^^^^^^^^^^^^^^^^^ help: try using `and_then` instead: `opt.and_then(bar)`
23
23
24
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:19 :26
25
+ --> $DIR/option_map_or_none.rs:20 :26
26
26
|
27
27
LL | let _: Option<i32> = opt.map_or(None, |x| {
28
28
| __________________________^
@@ -41,5 +41,13 @@ LL + Some(offset + height)
41
41
LL ~ });
42
42
|
43
43
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
45
53
0 commit comments