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

Unintuitive operator precedence #41

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

Unintuitive operator precedence #41

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

Comments

@llogiq
Copy link
Contributor

llogiq commented May 3, 2015

Warn on instances of _ << _ + _ (or similar cases involving seldom-used operators). While those are not wrong, they can become footguns for anyone trying to reason about the code.

Suggest parenthesizing the operation.

@llogiq
Copy link
Contributor Author

llogiq commented May 5, 2015

I have a few examples on http://is.gd/Rz0BtT (rust playpen).

The lint should detect ExprBinary(op1, ExprBinary(op2, …), …) or ExprBinary(op1, …, ExprBinary(op2, …) where op1 and op2 are from different operator classes (arithmetic vs. bit-shifting/bit-combining).

@llogiq llogiq self-assigned this May 6, 2015
llogiq added a commit that referenced this issue May 6, 2015
llogiq added a commit that referenced this issue May 6, 2015
New lint: precedence, see issue #41
@llogiq
Copy link
Contributor Author

llogiq commented May 6, 2015

Done.

@llogiq llogiq closed this as completed May 6, 2015
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

1 participant