-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
WIP: Lint using bitwise operators for boolean expressions #3385
Conversation
LGTM, as you already stated, the documentation and testing is missing. I would make this lint a |
Ping from triage @fhartwig: It looks like this PR hasn't received any updates in a while, so I'm closing it per our new guidelines. Thank you for your contributions and please feel free to re-open in the future. |
Add `needless_bitwise_bool` lint fixes #6827 fixes #1594 changelog: Add ``[`needless_bitwise_bool`]`` lint Creates a new `bitwise_bool` lint to convert `x & y` to `x && y` when both `x` and `y` are booleans. I also had to adjust thh `needless_bool` lint slightly, and fix a couple failing dogfood tests. I made it a correctness lint as per flip1995's comment [here](#3385 (comment)), from a previous WIP attempt at this lint.
Add `needless_bitwise_bool` lint fixes #6827 fixes #1594 changelog: Add ``[`needless_bitwise_bool`]`` lint Creates a new `bitwise_bool` lint to convert `x & y` to `x && y` when both `x` and `y` are booleans. I also had to adjust thh `needless_bool` lint slightly, and fix a couple failing dogfood tests. I made it a correctness lint as per flip1995's comment [here](#3385 (comment)), from a previous WIP attempt at this lint.
Add `needless_bitwise_bool` lint fixes #6827 fixes #1594 changelog: Add ``[`needless_bitwise_bool`]`` lint Creates a new `bitwise_bool` lint to convert `x & y` to `x && y` when both `x` and `y` are booleans. I also had to adjust thh `needless_bool` lint slightly, and fix a couple failing dogfood tests. I made it a correctness lint as per flip1995's comment [here](#3385 (comment)), from a previous WIP attempt at this lint.
@rustbot label -S-inactive-closed |
Fixes #1594
Still needs work (tests, documentation), but was hoping to get some feedback. One thing I'm not sure about is the lint level/type that this should be. I made it
style
for now, but that doesn't seem quite right, since I think this would mostly happen by accident. But I'm not sold oncorrectness
either, since this will work just fine most of the time (any time when short-circuiting isn't required for correctness). Any thoughts?