Skip to content

Commit 237fbdd

Browse files
committed
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
2 parents eb300fd + 183fade commit 237fbdd

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

clippy_lints/src/blocks_in_conditions.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_span::sym;
1313

1414
declare_clippy_lint! {
1515
/// ### What it does
16-
/// Checks for `if` conditions that use blocks containing an
16+
/// Checks for `if` and `match` conditions that use blocks containing an
1717
/// expression, statements or conditions that use closures with blocks.
1818
///
1919
/// ### Why is this bad?
@@ -25,6 +25,11 @@ declare_clippy_lint! {
2525
/// if { true } { /* ... */ }
2626
///
2727
/// if { let x = somefunc(); x } { /* ... */ }
28+
///
29+
/// match { let e = somefunc(); e } {
30+
/// // ...
31+
/// # _ => {}
32+
/// }
2833
/// ```
2934
///
3035
/// Use instead:
@@ -34,6 +39,12 @@ declare_clippy_lint! {
3439
///
3540
/// let res = { let x = somefunc(); x };
3641
/// if res { /* ... */ }
42+
///
43+
/// let res = { let e = somefunc(); e };
44+
/// match res {
45+
/// // ...
46+
/// # _ => {}
47+
/// }
3748
/// ```
3849
#[clippy::version = "1.45.0"]
3950
pub BLOCKS_IN_CONDITIONS,

0 commit comments

Comments
 (0)