New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend NONMINIMAL_BOOL
lint
#12248
Extend NONMINIMAL_BOOL
lint
#12248
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be merged, but to fix #5794 this would need a test for !a != 12
Noted. Gonna add support for this case. |
Euh wait, no. It's not the same, unless |
f38ead7
to
f122149
Compare
Shouldn't this be true for integers as well? e.g., |
Oh wow nvm, I thought this was for bool only. It already lints integers too |
Anything else to be done here then? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a mini-nit, could you squash the commits?
clippy_lints/src/booleans.rs
Outdated
ExprKind::Unary(UnOp::Not, sub) => check_inverted_condition(cx, expr.span, sub), | ||
ExprKind::Binary(op, left, right) if matches!(op.node, BinOpKind::Eq | BinOpKind::Ne) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should have a comment talking about what case they cover, just for clarity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, done.
f122149
to
5e7c437
Compare
I squashed the commits in two commits as I still want to keep the "inverted boolean in comparison" in its own commit as it feels like a different kind of check. |
@bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
I think this probably introduced #12371 |
Fixes #5794.
r? @blyxyas
changelog: Extend
NONMINIMAL_BOOL
lint