allow dead code in the test

This commit is contained in:
y21 2023-06-28 17:00:54 +02:00
parent 733a9ea6b9
commit cee4c4169c
3 changed files with 4 additions and 8 deletions

View File

@ -198,8 +198,6 @@ fn main() {
let _ = res.map_or(1, |a| a + 1);
let _ = res.map_or(1, |a| a + 1);
let _ = res.map_or(5, |a| a + 1);
issue10729::reproduce(&None);
issue10729::reproduce2(&mut None);
}
#[allow(dead_code)]
@ -212,7 +210,7 @@ fn issue9742() -> Option<&'static str> {
}
mod issue10729 {
#![allow(clippy::unit_arg)]
#![allow(clippy::unit_arg, dead_code)]
pub fn reproduce(initial: &Option<String>) {
// 👇 needs `.as_ref()` because initial is an `&Option<_>`

View File

@ -239,8 +239,6 @@ fn main() {
Ok(a) => a + 1,
};
let _ = if let Ok(a) = res { a + 1 } else { 5 };
issue10729::reproduce(&None);
issue10729::reproduce2(&mut None);
}
#[allow(dead_code)]
@ -253,7 +251,7 @@ fn issue9742() -> Option<&'static str> {
}
mod issue10729 {
#![allow(clippy::unit_arg)]
#![allow(clippy::unit_arg, dead_code)]
pub fn reproduce(initial: &Option<String>) {
// 👇 needs `.as_ref()` because initial is an `&Option<_>`

View File

@ -272,7 +272,7 @@ LL | let _ = if let Ok(a) = res { a + 1 } else { 5 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `res.map_or(5, |a| a + 1)`
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:260:9
--> $DIR/option_if_let_else.rs:258:9
|
LL | / match initial {
LL | | Some(value) => do_something(value),
@ -281,7 +281,7 @@ LL | | }
| |_________^ help: try: `initial.as_ref().map_or({}, |value| do_something(value))`
error: use Option::map_or instead of an if let/else
--> $DIR/option_if_let_else.rs:267:9
--> $DIR/option_if_let_else.rs:265:9
|
LL | / match initial {
LL | | Some(value) => do_something2(value),