uv
7d2abd05 - clippy: allow `if_not_else`

Commit
1 year ago
clippy: allow `if_not_else` This lint fires when an `if` negates the condition. The lint instead suggests that the condition should be un-negated and the `if` and `else` bodies flipped. I find this to be a pretty annoying lint, because sometimes I want to keep the order of the `if` and `else` bodies as-is, and not make it subject to whether the primary condition is negated or not. Sometimes it's for linear scanning reasons (where the `if` block is smaller), and sometimes it's for "code parallelism" reasons (i.e., this block of code looks like another block of code intentionally). Moreover, I don't think the benefits of this lint are very big. I do agree that sometimes negating a conditional can make it harder to read (e.g., a double negative), but it's nowhere near a universal truth enough to ban it outright.
Author
Committer
Parents
Loading