mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-13 20:46:48 +00:00
add test for block comment and add note to description
This commit is contained in:
parent
d7e723441e
commit
2e856fa99b
@ -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`.
|
||||
///
|
||||
|
@ -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.
|
||||
*/
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
*/
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user