Make needless_bool less aggressive for chained `if`s (#17598)
In a function with multiple `if .. { return _; }`s with a trailing `!_`
at the end, combining the last `if`+`!_` doesn't make the code less
complex necessarily. It just moves the "problem" one up. Piping this
through the entire `if` chain in the function either requires a
non-trivial refactor or makes the code potentially less readable. Both
are not acceptable for a complexity lint.
This adds a check to the lint that makes sure that there is no other
`if` statement before the last collapsible `if` statement.
changelog: none
(Will be synced together with the commit that introduces it, so no
changelog entry required) P
Philipp Krones committed
b962eb831030c45ce6c8fcaaa5b288ce459ca9b1
Committed by GitHub <noreply@github.com>
on 8/21/2026, 4:25:20 PM