Skip to content

Commit

Permalink
Auto merge of #12296 - kaffarell:master, r=xFrednet
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Feb 15, 2024
2 parents eb300fd + 183fade commit 237fbdd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion clippy_lints/src/blocks_in_conditions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -25,6 +25,11 @@ declare_clippy_lint! {
/// if { true } { /* ... */ }
///
/// if { let x = somefunc(); x } { /* ... */ }
///
/// match { let e = somefunc(); e } {
/// // ...
/// # _ => {}
/// }
/// ```
///
/// Use instead:
Expand All @@ -34,6 +39,12 @@ 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,
Expand Down

0 comments on commit 237fbdd

Please sign in to comment.