From f4eb6bd709cedf9e0b0baf904e06cbebcc884c64 Mon Sep 17 00:00:00 2001 From: Gabriel Goller Date: Thu, 15 Feb 2024 11:05:25 +0100 Subject: [PATCH] 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. --- clippy_lints/src/blocks_in_conditions.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/clippy_lints/src/blocks_in_conditions.rs b/clippy_lints/src/blocks_in_conditions.rs index eae87db26c6..62ef810f12b 100644 --- a/clippy_lints/src/blocks_in_conditions.rs +++ b/clippy_lints/src/blocks_in_conditions.rs @@ -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,