File tree 3 files changed +4
-8
lines changed 3 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -198,8 +198,6 @@ fn main() {
198
198
let _ = res.map_or(1, |a| a + 1);
199
199
let _ = res.map_or(1, |a| a + 1);
200
200
let _ = res.map_or(5, |a| a + 1);
201
- issue10729::reproduce(&None);
202
- issue10729::reproduce2(&mut None);
203
201
}
204
202
205
203
#[allow(dead_code)]
@@ -212,7 +210,7 @@ fn issue9742() -> Option<&'static str> {
212
210
}
213
211
214
212
mod issue10729 {
215
- #![allow(clippy::unit_arg)]
213
+ #![allow(clippy::unit_arg, dead_code )]
216
214
217
215
pub fn reproduce(initial: &Option<String>) {
218
216
// 👇 needs `.as_ref()` because initial is an `&Option<_>`
Original file line number Diff line number Diff line change @@ -239,8 +239,6 @@ fn main() {
239
239
Ok ( a) => a + 1 ,
240
240
} ;
241
241
let _ = if let Ok ( a) = res { a + 1 } else { 5 } ;
242
- issue10729:: reproduce ( & None ) ;
243
- issue10729:: reproduce2 ( & mut None ) ;
244
242
}
245
243
246
244
#[ allow( dead_code) ]
@@ -253,7 +251,7 @@ fn issue9742() -> Option<&'static str> {
253
251
}
254
252
255
253
mod issue10729 {
256
- #![ allow( clippy:: unit_arg) ]
254
+ #![ allow( clippy:: unit_arg, dead_code ) ]
257
255
258
256
pub fn reproduce ( initial : & Option < String > ) {
259
257
// 👇 needs `.as_ref()` because initial is an `&Option<_>`
Original file line number Diff line number Diff line change @@ -272,7 +272,7 @@ LL | let _ = if let Ok(a) = res { a + 1 } else { 5 };
272
272
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `res.map_or(5, |a| a + 1)`
273
273
274
274
error: use Option::map_or instead of an if let/else
275
- --> $DIR/option_if_let_else.rs:260 :9
275
+ --> $DIR/option_if_let_else.rs:258 :9
276
276
|
277
277
LL | / match initial {
278
278
LL | | Some(value) => do_something(value),
@@ -281,7 +281,7 @@ LL | | }
281
281
| |_________^ help: try: `initial.as_ref().map_or({}, |value| do_something(value))`
282
282
283
283
error: use Option::map_or instead of an if let/else
284
- --> $DIR/option_if_let_else.rs:267 :9
284
+ --> $DIR/option_if_let_else.rs:265 :9
285
285
|
286
286
LL | / match initial {
287
287
LL | | Some(value) => do_something2(value),
You can’t perform that action at this time.
0 commit comments