Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
Suppress blocks_in_if_conditions clippy lint
Browse files Browse the repository at this point in the history
This code is fine. Clippy's suggestion is not better.

    error: in an `if` condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`
       --> src/de.rs:990:5
        |
    990 | /     if {
    991 | |         let v = v.trim_start_matches(&['-', '+'][..]);
    992 | |         v.len() > 1 && v.starts_with('0') && v.bytes().all(|b| b.is_ascii_digit())
    993 | |     } {
        | |_____^
        |
        = note: `-D clippy::blocks-in-if-conditions` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#blocks_in_if_conditions
    help: try
        |
    990 ~     let res = {
    991 +         let v = v.trim_start_matches(&['-', '+'][..]);
    992 +         v.len() > 1 && v.starts_with('0') && v.bytes().all(|b| b.is_ascii_digit())
    993 ~     }; if res {
        |
  • Loading branch information
dtolnay committed Dec 13, 2021
1 parent 75a43c4 commit 983b5b3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/lib.rs
Expand Up @@ -84,6 +84,7 @@
clippy::redundant_else,
clippy::single_match_else,
// code is acceptable
clippy::blocks_in_if_conditions,
clippy::cast_possible_wrap,
clippy::cast_precision_loss,
clippy::doc_markdown,
Expand Down

0 comments on commit 983b5b3

Please sign in to comment.