-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 a new lint for comparison chains #4569
Conversation
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.
Awesome, thanks for working on this.
While I think this could be merged as is, it is also possible to emit a machine applicable suggestion. If you'd like to do that, too, we can either merge the PR and you open a new one adding the suggestion, or you can add it to this PR, whatever you prefer.
@oli-obk Actually I think I'd be more comfortable with merging the branch as it is right now then opening another PR with the machine applicable suggestion in the future. |
@bors r+ |
📌 Commit 2f34576 has been approved by |
Add a new lint for comparison chains changelog: Adds a new lint: `comparison_chain`. `comparison_chain` lints all `if` conditional chains where all the conditions are binary comparisons on the same two operands and will suggest a rewrite with `match`. Closes #4531.
💔 Test failed - status-appveyor |
@bors retry |
Add a new lint for comparison chains changelog: Adds a new lint: `comparison_chain`. `comparison_chain` lints all `if` conditional chains where all the conditions are binary comparisons on the same two operands and will suggest a rewrite with `match`. Closes #4531.
☀️ Test successful - checks-travis, status-appveyor |
changelog: Adds a new lint:
comparison_chain
.comparison_chain
lints allif
conditional chains where all the conditions are binary comparisons on the same two operands and will suggest a rewrite withmatch
.Closes #4531.