11error: 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 .rs:17:13
2+ --> $DIR/map_unwrap_or .rs:17:13
33 |
44LL | let _ = opt.map(|x| x + 1)
55 | _____________^
66LL | | // Should lint even though this call is on a separate line.
77LL | | .unwrap_or(0);
88 | |_____________________^
99 |
10- = note: `-D clippy::map-unwrap` implied by `-D warnings`
10+ = note: `-D clippy::map-unwrap-or ` implied by `-D warnings`
1111help: use `map_or(a, f)` instead
1212 |
1313LL | let _ = opt.map_or(0, |x| x + 1);
1414 | ^^^^^^ ^^ --
1515
1616error: 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 .rs:21:13
17+ --> $DIR/map_unwrap_or .rs:21:13
1818 |
1919LL | let _ = opt.map(|x| {
2020 | _____________^
@@ -32,7 +32,7 @@ LL | );
3232 |
3333
3434error: 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 .rs:25:13
35+ --> $DIR/map_unwrap_or .rs:25:13
3636 |
3737LL | let _ = opt.map(|x| x + 1)
3838 | _____________^
@@ -49,7 +49,7 @@ LL | }, |x| x + 1);
4949 |
5050
5151error: 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 .rs:30:13
52+ --> $DIR/map_unwrap_or .rs:30:13
5353 |
5454LL | let _ = opt.map(|x| Some(x + 1)).unwrap_or(None);
5555 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -60,7 +60,7 @@ LL | let _ = opt.and_then(|x| Some(x + 1));
6060 | ^^^^^^^^ --
6161
6262error: 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 .rs:32:13
63+ --> $DIR/map_unwrap_or .rs:32:13
6464 |
6565LL | let _ = opt.map(|x| {
6666 | _____________^
@@ -78,7 +78,7 @@ LL | );
7878 |
7979
8080error: 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 .rs:36:13
81+ --> $DIR/map_unwrap_or .rs:36:13
8282 |
8383LL | let _ = opt
8484 | _____________^
@@ -92,7 +92,7 @@ LL | .and_then(|x| Some(x + 1));
9292 | ^^^^^^^^ --
9393
9494error: 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 .rs:47:13
95+ --> $DIR/map_unwrap_or .rs:47:13
9696 |
9797LL | let _ = Some("prefix").map(|p| format!("{}.", p)).unwrap_or(id);
9898 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -103,7 +103,7 @@ LL | let _ = Some("prefix").map_or(id, |p| format!("{}.", p));
103103 | ^^^^^^ ^^^ --
104104
105105error: 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 .rs:51:13
106+ --> $DIR/map_unwrap_or .rs:51:13
107107 |
108108LL | let _ = opt.map(|x| x + 1)
109109 | _____________^
@@ -114,7 +114,7 @@ LL | | .unwrap_or_else(|| 0);
114114 = note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `map_or_else(|| 0, |x| x + 1)`
115115
116116error: 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
117- --> $DIR/map_unwrap .rs:55:13
117+ --> $DIR/map_unwrap_or .rs:55:13
118118 |
119119LL | let _ = opt.map(|x| {
120120 | _____________^
@@ -124,7 +124,7 @@ LL | | ).unwrap_or_else(|| 0);
124124 | |__________________________^
125125
126126error: 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
127- --> $DIR/map_unwrap .rs:59:13
127+ --> $DIR/map_unwrap_or .rs:59:13
128128 |
129129LL | let _ = opt.map(|x| x + 1)
130130 | _____________^
@@ -134,23 +134,23 @@ LL | | );
134134 | |_________^
135135
136136error: 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
137- --> $DIR/map_unwrap .rs:88:13
137+ --> $DIR/map_unwrap_or .rs:88:13
138138 |
139139LL | let _ = res.map(|x| x + 1).unwrap_or_else(|e| 0); // should lint even though this call is on a separate line
140140 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
141141 |
142142 = note: replace `map(|x| x + 1).unwrap_or_else(|e| 0)` with `map_or_else(|e| 0, |x| x + 1)`
143143
144144error: 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
145- --> $DIR/map_unwrap .rs:90:13
145+ --> $DIR/map_unwrap_or .rs:90:13
146146 |
147147LL | let _ = res.map(|x| x + 1).unwrap_or_else(|e| 0);
148148 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
149149 |
150150 = note: replace `map(|x| x + 1).unwrap_or_else(|e| 0)` with `map_or_else(|e| 0, |x| x + 1)`
151151
152152error: 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
153- --> $DIR/map_unwrap .rs:91:13
153+ --> $DIR/map_unwrap_or .rs:91:13
154154 |
155155LL | let _ = res.map(|x| x + 1).unwrap_or_else(|e| 0);
156156 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0 commit comments