about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGabriel Goller <g.goller@proxmox.com>2024-02-15 11:05:25 +0100
committerGabriel Goller <g.goller@proxmox.com>2024-02-15 11:05:25 +0100
commitf4eb6bd709cedf9e0b0baf904e06cbebcc884c64 (patch)
tree988a14f46a249c2c764d05573322d48cfb4485db
parenteb300fdad40e4761ad061e4bca5c61f25356ba4b (diff)
downloadrust-f4eb6bd709cedf9e0b0baf904e06cbebcc884c64.tar.gz
rust-f4eb6bd709cedf9e0b0baf904e06cbebcc884c64.zip
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.
-rw-r--r--clippy_lints/src/blocks_in_conditions.rs7
1 files changed, 6 insertions, 1 deletions
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,