1
1
error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
2
- --> $DIR/map_unwrap_or.rs:17:13
3
- |
4
- LL | let _ = opt.map(|x| x + 1)
5
- | _____________^
6
- LL | | // Should lint even though this call is on a separate line.
7
- LL | | .unwrap_or(0);
8
- | |_____________________^
9
- |
10
- = note: `-D clippy::map-unwrap-or` implied by `-D warnings`
11
- help: use `map_or(<a>, <f>)` instead
12
- |
13
- LL | let _ = opt.map_or(0, |x| x + 1);
14
- | ^^^^^^ ^^ --
15
-
16
- error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
17
- --> $DIR/map_unwrap_or.rs:21:13
2
+ --> $DIR/map_unwrap_or.rs:16:13
18
3
|
19
4
LL | let _ = opt.map(|x| {
20
5
| _____________^
@@ -23,6 +8,7 @@ LL | | }
23
8
LL | | ).unwrap_or(0);
24
9
| |__________________^
25
10
|
11
+ = note: `-D clippy::map-unwrap-or` implied by `-D warnings`
26
12
help: use `map_or(<a>, <f>)` instead
27
13
|
28
14
LL | let _ = opt.map_or(0, |x| {
@@ -32,7 +18,7 @@ LL | );
32
18
|
33
19
34
20
error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
35
- --> $DIR/map_unwrap_or.rs:25 :13
21
+ --> $DIR/map_unwrap_or.rs:20 :13
36
22
|
37
23
LL | let _ = opt.map(|x| x + 1)
38
24
| _____________^
@@ -49,7 +35,7 @@ LL | }, |x| x + 1);
49
35
|
50
36
51
37
error: called `map(<f>).unwrap_or(None)` on an `Option` value. This can be done more directly by calling `and_then(<f>)` instead
52
- --> $DIR/map_unwrap_or.rs:30 :13
38
+ --> $DIR/map_unwrap_or.rs:25 :13
53
39
|
54
40
LL | let _ = opt.map(|x| Some(x + 1)).unwrap_or(None);
55
41
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -60,7 +46,7 @@ LL | let _ = opt.and_then(|x| Some(x + 1));
60
46
| ^^^^^^^^ --
61
47
62
48
error: called `map(<f>).unwrap_or(None)` on an `Option` value. This can be done more directly by calling `and_then(<f>)` instead
63
- --> $DIR/map_unwrap_or.rs:32 :13
49
+ --> $DIR/map_unwrap_or.rs:27 :13
64
50
|
65
51
LL | let _ = opt.map(|x| {
66
52
| _____________^
@@ -78,7 +64,7 @@ LL | );
78
64
|
79
65
80
66
error: called `map(<f>).unwrap_or(None)` on an `Option` value. This can be done more directly by calling `and_then(<f>)` instead
81
- --> $DIR/map_unwrap_or.rs:36 :13
67
+ --> $DIR/map_unwrap_or.rs:31 :13
82
68
|
83
69
LL | let _ = opt
84
70
| _____________^
@@ -92,7 +78,7 @@ LL | .and_then(|x| Some(x + 1));
92
78
| ^^^^^^^^ --
93
79
94
80
error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
95
- --> $DIR/map_unwrap_or.rs:47 :13
81
+ --> $DIR/map_unwrap_or.rs:42 :13
96
82
|
97
83
LL | let _ = Some("prefix").map(|p| format!("{}.", p)).unwrap_or(id);
98
84
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -103,16 +89,7 @@ LL | let _ = Some("prefix").map_or(id, |p| format!("{}.", p));
103
89
| ^^^^^^ ^^^ --
104
90
105
91
error: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value. This can be done more directly by calling `map_or_else(<g>, <f>)` instead
106
- --> $DIR/map_unwrap_or.rs:51:13
107
- |
108
- LL | let _ = opt.map(|x| x + 1)
109
- | _____________^
110
- LL | | // Should lint even though this call is on a separate line.
111
- LL | | .unwrap_or_else(|| 0);
112
- | |_____________________________^ help: try this: `opt.map_or_else(|| 0, |x| x + 1)`
113
-
114
- error: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value. This can be done more directly by calling `map_or_else(<g>, <f>)` instead
115
- --> $DIR/map_unwrap_or.rs:55:13
92
+ --> $DIR/map_unwrap_or.rs:46:13
116
93
|
117
94
LL | let _ = opt.map(|x| {
118
95
| _____________^
@@ -122,7 +99,7 @@ LL | | ).unwrap_or_else(|| 0);
122
99
| |__________________________^
123
100
124
101
error: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value. This can be done more directly by calling `map_or_else(<g>, <f>)` instead
125
- --> $DIR/map_unwrap_or.rs:59 :13
102
+ --> $DIR/map_unwrap_or.rs:50 :13
126
103
|
127
104
LL | let _ = opt.map(|x| x + 1)
128
105
| _____________^
@@ -131,23 +108,5 @@ LL | | 0
131
108
LL | | );
132
109
| |_________^
133
110
134
- error: called `map(<f>).unwrap_or_else(<g>)` on a `Result` value. This can be done more directly by calling `.map_or_else(<g>, <f>)` instead
135
- --> $DIR/map_unwrap_or.rs:88:13
136
- |
137
- LL | let _ = res.map(|x| x + 1).unwrap_or_else(|e| 0); // should lint even though this call is on a separate line
138
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `res.map_or_else(|e| 0, |x| x + 1)`
139
-
140
- error: called `map(<f>).unwrap_or_else(<g>)` on a `Result` value. This can be done more directly by calling `.map_or_else(<g>, <f>)` instead
141
- --> $DIR/map_unwrap_or.rs:90:13
142
- |
143
- LL | let _ = res.map(|x| x + 1).unwrap_or_else(|e| 0);
144
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `res.map_or_else(|e| 0, |x| x + 1)`
145
-
146
- error: called `map(<f>).unwrap_or_else(<g>)` on a `Result` value. This can be done more directly by calling `.map_or_else(<g>, <f>)` instead
147
- --> $DIR/map_unwrap_or.rs:91:13
148
- |
149
- LL | let _ = res.map(|x| x + 1).unwrap_or_else(|e| 0);
150
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `res.map_or_else(|e| 0, |x| x + 1)`
151
-
152
- error: aborting due to 13 previous errors
111
+ error: aborting due to 8 previous errors
153
112
0 commit comments