fix: documentation of blocks_in_conditions lint

Updated documentation + example of `blocks_in_conditions` lint, which
has been updated recently to include `match` statements as well.
This commit is contained in:
Gabriel Goller 2024-02-15 11:05:25 +01:00
parent eb300fdad4
commit f4eb6bd709

View File

@ -13,7 +13,7 @@ use rustc_span::sym;
declare_clippy_lint! {
/// ### What it does
/// Checks for `if` conditions that use blocks containing an
/// Checks for `if` and `match` conditions that use blocks containing an
/// expression, statements or conditions that use closures with blocks.
///
/// ### Why is this bad?
@ -25,6 +25,8 @@ declare_clippy_lint! {
/// if { true } { /* ... */ }
///
/// if { let x = somefunc(); x } { /* ... */ }
///
/// match { let e = somefunc(); e } { /* ... */ }
/// ```
///
/// Use instead:
@ -34,6 +36,9 @@ declare_clippy_lint! {
///
/// let res = { let x = somefunc(); x };
/// if res { /* ... */ }
///
/// let res = { let e = somefunc(); e };
/// match res { /* ... */ }
/// ```
#[clippy::version = "1.45.0"]
pub BLOCKS_IN_CONDITIONS,