Auto merge of #12296 - kaffarell:master, r=xFrednet

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.

changelog: none
This commit is contained in:
bors
2024-02-15 12:20:38 +00:00
+12 -1
View File
@@ -13,7 +13,7 @@
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,11 @@
/// if { true } { /* ... */ }
///
/// if { let x = somefunc(); x } { /* ... */ }
///
/// match { let e = somefunc(); e } {
/// // ...
/// # _ => {}
/// }
/// ```
///
/// Use instead:
@@ -34,6 +39,12 @@
///
/// 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,