Skip to content
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

add another lint to bit_mask to warn on ineffective masks #53

Closed
llogiq opened this issue May 9, 2015 · 3 comments
Closed

add another lint to bit_mask to warn on ineffective masks #53

llogiq opened this issue May 9, 2015 · 3 comments
Assignees

Comments

@llogiq
Copy link
Contributor

llogiq commented May 9, 2015

Currently, bad_bit_mask ignores masks that do not make the result of the whole expression constant, but don't add any value, e.g. x|0 or x & -1 or even x | 1 > 2 (because the former are always equal to x and latter is equal to x > 2 – they're not wrong per se, but may be misleading.

So let's have BitMask implement a second lint type (that is Warn instead of Deny), which I'd call ineffective_bit_mask.

@lambda-fairy
Copy link

If we aren't already, we should warn about identity operations in general like x * 1 or 0 + x.

@llogiq
Copy link
Contributor Author

llogiq commented May 10, 2015

That, too. So the lint should probably only warn about bit masks that are not by themselves identity operations, but which are rendered ineffective by the comparison.

Another "identity_op" lint should then check direct identity operations.

@llogiq
Copy link
Contributor Author

llogiq commented May 15, 2015

Done.

@llogiq llogiq closed this as completed May 15, 2015
yaahc pushed a commit to yaahc/rust-clippy that referenced this issue Mar 14, 2019
Handle misformatted versions with a nicer error message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants