Skip to content

Add lint for use of ^ operator as exponentiation. #4541

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from
Closed

Add lint for use of ^ operator as exponentiation. #4541

wants to merge 1 commit into from

Conversation

jolson88
Copy link
Contributor

Re-opens and updates the closed PR to add this new lint.

Incorporated review feedback from previous PR and added functionality around .pow() and std::_::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.

@flip1995 flip1995 added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 17, 2019
@bors
Copy link
Contributor

bors commented Sep 20, 2019

☔ The latest upstream changes (presumably #4511) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Sep 26, 2019

☔ The latest upstream changes (presumably #4569) made this pull request unmergeable. Please resolve the merge conflicts.

@jolson88
Copy link
Contributor Author

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 {
Copy link

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?

@bors
Copy link
Contributor

bors commented Oct 8, 2019

☔ The latest upstream changes (presumably #4592) made this pull request unmergeable. Please resolve the merge conflicts.

@flip1995 flip1995 added the A-lint Area: New lints label Nov 25, 2019
@flip1995
Copy link
Member

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.

@flip1995 flip1995 closed this May 25, 2020
@flip1995 flip1995 added S-inactive-closed Status: Closed due to inactivity and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels May 25, 2020
@cgm616
Copy link
Contributor

cgm616 commented Oct 16, 2020

I'd like to pick this up and pull it over the finish line, if possible.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-lint Area: New lints
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Catch xor vs power confusion
7 participants