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

Commit

Permalink
Ignore while_immutable_condition clippy false positive
Browse files Browse the repository at this point in the history
rust-lang/rust-clippy#3548

    error: variables in the condition are not mutated in the loop body
        --> src/scanner.rs:1031:15
         |
    1031 |           while CHECK!((*parser).buffer, b' ')
         |  _______________^
    1032 | |             || ((*parser).flow_level != 0 || (*parser).simple_key_allowed == 0)
    1033 | |                 && CHECK!((*parser).buffer, b'\t')
         | |__________________________________________________^
         |
         = note: `-D clippy::while-immutable-condition` implied by `-D clippy::all`
         = note: this may lead to an infinite or to a never running loop
         = note: this loop contains `return`s or `break`s
         = help: rewrite it as `if cond { loop { } }`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#while_immutable_condition

    error: variables in the condition are not mutated in the loop body
        --> src/macros.rs:138:9
         |
    138  |         *$string.pointer >= b'0' && *$string.pointer <= b'9'
         |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         |
        ::: src/scanner.rs:1319:11
         |
    1319 |     while IS_DIGIT!((*parser).buffer) {
         |           --------------------------- in this macro invocation
         |
         = note: this may lead to an infinite or to a never running loop
         = note: this loop contains `return`s or `break`s
         = help: rewrite it as `if cond { loop { } }`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#while_immutable_condition
         = note: this error originates in the macro `IS_DIGIT` (in Nightly builds, run with -Z macro-backtrace for more info)
  • Loading branch information
dtolnay committed Jul 23, 2022
1 parent d08887f commit 1436752
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
clippy::single_match_else,
clippy::too_many_arguments,
clippy::too_many_lines,
clippy::unreadable_literal
clippy::unreadable_literal,
clippy::while_immutable_condition, // https://github.com/rust-lang/rust-clippy/issues/3548
)]

extern crate alloc;
Expand Down

0 comments on commit 1436752

Please sign in to comment.