11error: manual implementation of `Option::map`
2- --> $DIR/manual_map_option.rs:14 :5
2+ --> $DIR/manual_map_option.rs:15 :5
33 |
44LL | / match Some(0) {
55LL | | Some(_) => Some(2),
@@ -10,7 +10,7 @@ LL | | };
1010 = note: `-D clippy::manual-map` implied by `-D warnings`
1111
1212error: manual implementation of `Option::map`
13- --> $DIR/manual_map_option.rs:19 :5
13+ --> $DIR/manual_map_option.rs:20 :5
1414 |
1515LL | / match Some(0) {
1616LL | | Some(x) => Some(x + 1),
@@ -19,7 +19,7 @@ LL | | };
1919 | |_____^ help: try this: `Some(0).map(|x| x + 1)`
2020
2121error: manual implementation of `Option::map`
22- --> $DIR/manual_map_option.rs:24 :5
22+ --> $DIR/manual_map_option.rs:25 :5
2323 |
2424LL | / match Some("") {
2525LL | | Some(x) => Some(x.is_empty()),
@@ -28,7 +28,7 @@ LL | | };
2828 | |_____^ help: try this: `Some("").map(|x| x.is_empty())`
2929
3030error: manual implementation of `Option::map`
31- --> $DIR/manual_map_option.rs:29 :5
31+ --> $DIR/manual_map_option.rs:30 :5
3232 |
3333LL | / if let Some(x) = Some(0) {
3434LL | | Some(!x)
@@ -38,7 +38,7 @@ LL | | };
3838 | |_____^ help: try this: `Some(0).map(|x| !x)`
3939
4040error: manual implementation of `Option::map`
41- --> $DIR/manual_map_option.rs:36 :5
41+ --> $DIR/manual_map_option.rs:37 :5
4242 |
4343LL | / match Some(0) {
4444LL | | Some(x) => { Some(std::convert::identity(x)) }
@@ -47,7 +47,7 @@ LL | | };
4747 | |_____^ help: try this: `Some(0).map(std::convert::identity)`
4848
4949error: manual implementation of `Option::map`
50- --> $DIR/manual_map_option.rs:41 :5
50+ --> $DIR/manual_map_option.rs:42 :5
5151 |
5252LL | / match Some(&String::new()) {
5353LL | | Some(x) => Some(str::len(x)),
@@ -56,7 +56,7 @@ LL | | };
5656 | |_____^ help: try this: `Some(&String::new()).map(|x| str::len(x))`
5757
5858error: manual implementation of `Option::map`
59- --> $DIR/manual_map_option.rs:51 :5
59+ --> $DIR/manual_map_option.rs:52 :5
6060 |
6161LL | / match &Some([0, 1]) {
6262LL | | Some(x) => Some(x[0]),
@@ -65,7 +65,7 @@ LL | | };
6565 | |_____^ help: try this: `Some([0, 1]).as_ref().map(|x| x[0])`
6666
6767error: manual implementation of `Option::map`
68- --> $DIR/manual_map_option.rs:56 :5
68+ --> $DIR/manual_map_option.rs:57 :5
6969 |
7070LL | / match &Some(0) {
7171LL | | &Some(x) => Some(x * 2),
@@ -74,7 +74,7 @@ LL | | };
7474 | |_____^ help: try this: `Some(0).map(|x| x * 2)`
7575
7676error: manual implementation of `Option::map`
77- --> $DIR/manual_map_option.rs:61 :5
77+ --> $DIR/manual_map_option.rs:62 :5
7878 |
7979LL | / match Some(String::new()) {
8080LL | | Some(ref x) => Some(x.is_empty()),
@@ -83,7 +83,7 @@ LL | | };
8383 | |_____^ help: try this: `Some(String::new()).as_ref().map(|x| x.is_empty())`
8484
8585error: manual implementation of `Option::map`
86- --> $DIR/manual_map_option.rs:66 :5
86+ --> $DIR/manual_map_option.rs:67 :5
8787 |
8888LL | / match &&Some(String::new()) {
8989LL | | Some(x) => Some(x.len()),
@@ -92,7 +92,7 @@ LL | | };
9292 | |_____^ help: try this: `Some(String::new()).as_ref().map(|x| x.len())`
9393
9494error: manual implementation of `Option::map`
95- --> $DIR/manual_map_option.rs:71 :5
95+ --> $DIR/manual_map_option.rs:72 :5
9696 |
9797LL | / match &&Some(0) {
9898LL | | &&Some(x) => Some(x + x),
@@ -101,7 +101,7 @@ LL | | };
101101 | |_____^ help: try this: `Some(0).map(|x| x + x)`
102102
103103error: manual implementation of `Option::map`
104- --> $DIR/manual_map_option.rs:84 :9
104+ --> $DIR/manual_map_option.rs:85 :9
105105 |
106106LL | / match &mut Some(String::new()) {
107107LL | | Some(x) => Some(x.push_str("")),
@@ -110,7 +110,7 @@ LL | | };
110110 | |_________^ help: try this: `Some(String::new()).as_mut().map(|x| x.push_str(""))`
111111
112112error: manual implementation of `Option::map`
113- --> $DIR/manual_map_option.rs:90 :5
113+ --> $DIR/manual_map_option.rs:91 :5
114114 |
115115LL | / match &mut Some(String::new()) {
116116LL | | Some(ref x) => Some(x.len()),
@@ -119,7 +119,7 @@ LL | | };
119119 | |_____^ help: try this: `Some(String::new()).as_ref().map(|x| x.len())`
120120
121121error: manual implementation of `Option::map`
122- --> $DIR/manual_map_option.rs:95 :5
122+ --> $DIR/manual_map_option.rs:96 :5
123123 |
124124LL | / match &mut &Some(String::new()) {
125125LL | | Some(x) => Some(x.is_empty()),
@@ -128,7 +128,7 @@ LL | | };
128128 | |_____^ help: try this: `Some(String::new()).as_ref().map(|x| x.is_empty())`
129129
130130error: manual implementation of `Option::map`
131- --> $DIR/manual_map_option.rs:100 :5
131+ --> $DIR/manual_map_option.rs:101 :5
132132 |
133133LL | / match Some((0, 1, 2)) {
134134LL | | Some((x, y, z)) => Some(x + y + z),
@@ -137,7 +137,7 @@ LL | | };
137137 | |_____^ help: try this: `Some((0, 1, 2)).map(|(x, y, z)| x + y + z)`
138138
139139error: manual implementation of `Option::map`
140- --> $DIR/manual_map_option.rs:105 :5
140+ --> $DIR/manual_map_option.rs:106 :5
141141 |
142142LL | / match Some([1, 2, 3]) {
143143LL | | Some([first, ..]) => Some(first),
@@ -146,7 +146,7 @@ LL | | };
146146 | |_____^ help: try this: `Some([1, 2, 3]).map(|[first, ..]| first)`
147147
148148error: manual implementation of `Option::map`
149- --> $DIR/manual_map_option.rs:110 :5
149+ --> $DIR/manual_map_option.rs:111 :5
150150 |
151151LL | / match &Some((String::new(), "test")) {
152152LL | | Some((x, y)) => Some((y, x)),
@@ -155,7 +155,7 @@ LL | | };
155155 | |_____^ help: try this: `Some((String::new(), "test")).as_ref().map(|(x, y)| (y, x))`
156156
157157error: manual implementation of `Option::map`
158- --> $DIR/manual_map_option.rs:168 :5
158+ --> $DIR/manual_map_option.rs:169 :5
159159 |
160160LL | / match Some(0) {
161161LL | | Some(x) => Some(vec![x]),
@@ -164,24 +164,27 @@ LL | | };
164164 | |_____^ help: try this: `Some(0).map(|x| vec![x])`
165165
166166error: manual implementation of `Option::map`
167- --> $DIR/manual_map_option.rs:173 :5
167+ --> $DIR/manual_map_option.rs:174 :5
168168 |
169169LL | / match option_env!("") {
170170LL | | Some(x) => Some(String::from(x)),
171171LL | | None => None,
172172LL | | };
173173 | |_____^ help: try this: `option_env!("").map(String::from)`
174174
175- error: redundant pattern matching, consider using `is_some()`
176- --> $DIR/manual_map_option.rs:191:12
177- |
178- LL | if let Some(_) = Some(0) {
179- | -------^^^^^^^---------- help: try this: `if Some(0).is_some()`
175+ error: manual implementation of `Option::map`
176+ --> $DIR/manual_map_option.rs:194:12
180177 |
181- = note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
178+ LL | } else if let Some(x) = Some(0) {
179+ | ____________^
180+ LL | | Some(x + 1)
181+ LL | | } else {
182+ LL | | None
183+ LL | | };
184+ | |_____^ help: try this: `{ Some(0).map(|x| x + 1) }`
182185
183186error: manual implementation of `Option::map`
184- --> $DIR/manual_map_option.rs:193 :12
187+ --> $DIR/manual_map_option.rs:202 :12
185188 |
186189LL | } else if let Some(x) = Some(0) {
187190 | ____________^
0 commit comments