Skip to content

Commit cee4c41

Browse files
committed
allow dead code in the test
1 parent 733a9ea commit cee4c41

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

tests/ui/option_if_let_else.fixed

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,6 @@ fn main() {
198198
let _ = res.map_or(1, |a| a + 1);
199199
let _ = res.map_or(1, |a| a + 1);
200200
let _ = res.map_or(5, |a| a + 1);
201-
issue10729::reproduce(&None);
202-
issue10729::reproduce2(&mut None);
203201
}
204202

205203
#[allow(dead_code)]
@@ -212,7 +210,7 @@ fn issue9742() -> Option<&'static str> {
212210
}
213211

214212
mod issue10729 {
215-
#![allow(clippy::unit_arg)]
213+
#![allow(clippy::unit_arg, dead_code)]
216214

217215
pub fn reproduce(initial: &Option<String>) {
218216
// 👇 needs `.as_ref()` because initial is an `&Option<_>`

tests/ui/option_if_let_else.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,6 @@ fn main() {
239239
Ok(a) => a + 1,
240240
};
241241
let _ = if let Ok(a) = res { a + 1 } else { 5 };
242-
issue10729::reproduce(&None);
243-
issue10729::reproduce2(&mut None);
244242
}
245243

246244
#[allow(dead_code)]
@@ -253,7 +251,7 @@ fn issue9742() -> Option<&'static str> {
253251
}
254252

255253
mod issue10729 {
256-
#![allow(clippy::unit_arg)]
254+
#![allow(clippy::unit_arg, dead_code)]
257255

258256
pub fn reproduce(initial: &Option<String>) {
259257
// 👇 needs `.as_ref()` because initial is an `&Option<_>`

tests/ui/option_if_let_else.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ LL | let _ = if let Ok(a) = res { a + 1 } else { 5 };
272272
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `res.map_or(5, |a| a + 1)`
273273

274274
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
276276
|
277277
LL | / match initial {
278278
LL | | Some(value) => do_something(value),
@@ -281,7 +281,7 @@ LL | | }
281281
| |_________^ help: try: `initial.as_ref().map_or({}, |value| do_something(value))`
282282

283283
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
285285
|
286286
LL | / match initial {
287287
LL | | Some(value) => do_something2(value),

0 commit comments

Comments
 (0)