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

clippy::identity-op triggering on 1 << 0 #3445

Closed
cramertj opened this issue Nov 21, 2018 · 2 comments
Closed

clippy::identity-op triggering on 1 << 0 #3445

cramertj opened this issue Nov 21, 2018 · 2 comments

Comments

@cramertj
Copy link
Member

When writing bitflags it's convenient to structure code like this:

const X: usize = 1 << 0;
const Y: usize = 1 << 1;
const Z: usize = 1 << 2;

Clippy lints against the 1 << 0 because it has no effect. This is a fairly common structure-- it'd be nice to perhaps make an exception for this specific case.

@hcpl
Copy link

hcpl commented Nov 21, 2018

Duplicate of #3430?

@cramertj
Copy link
Member Author

Yup! I searched but didn't see it. Thanks!

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