add test for block comment and add note to description

This commit is contained in:
y21 2023-06-19 20:07:31 +02:00
parent d7e723441e
commit 2e856fa99b
3 changed files with 33 additions and 0 deletions

View File

@ -38,6 +38,11 @@ declare_clippy_lint! {
/// Checks for matches with a single arm where an `if let`
/// will usually suffice.
///
/// This intentionally does not lint if there are comments
/// inside of the other arm, so as to allow the user to document
/// why having another explicit pattern with an empty body is necessary,
/// or because the comments need to be preserved for other reasons.
///
/// ### Why is this bad?
/// Just readability `if let` nests less than a `match`.
///

View File

@ -237,4 +237,18 @@ mod issue8634 {
},
}
}
fn block_comment(x: Result<i32, SomeError>) {
match x {
Ok(y) => {
println!("Yay! {y}");
},
Err(_) => {
/*
let's make sure that this also
does not lint block comments.
*/
},
}
}
}

View File

@ -295,4 +295,18 @@ mod issue8634 {
},
}
}
fn block_comment(x: Result<i32, SomeError>) {
match x {
Ok(y) => {
println!("Yay! {y}");
},
Err(_) => {
/*
let's make sure that this also
does not lint block comments.
*/
},
}
}
}