-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 lint for use of ^ operator as exponentiation. #4541
Conversation
☔ The latest upstream changes (presumably #4511) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #4569) made this pull request unmergeable. Please resolve the merge conflicts. |
Rebased and force-pushed again to bring inline with upstream. |
if let LitKind::Int(rhs, _) = lit.node; | ||
then { | ||
if lhs == 2 { | ||
if rhs == 8 || rhs == 16 || rhs == 32 || rhs == 64 { |
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.
Should we account for u128 as well?
☔ The latest upstream changes (presumably #4592) made this pull request unmergeable. Please resolve the merge conflicts. |
Thanks for contributing to Clippy! Sadly this PR was not updated in quite some time. If you waited on input from a reviewer, we're sorry that this fell under the radar. If you want to continue to work on this, just reopen the PR and/or ping a reviewer. |
I'd like to pick this up and pull it over the finish line, if possible. |
Re-opens and updates the closed PR to add this new lint.
Incorporated review feedback from previous PR and added functionality around
.pow()
andstd::_::MAX
. Also tried to cleanup the messages to be more user friendly.Fixes #4205
changelog: Add lint for using xor operator when exponentiation was intended.