-
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
New lint idea: suggest ^ when comparing bools #4983
Comments
I think this might be a bit "too much". Code should be readable in the first place, and comprehending |
Yes, but reducing |
Yeah I agree, that suggesting So when implementing a lint for |
Thanks for your feedback. I also had a feeling that suggestion to use However, suggesting I'm not sure about |
This could maybe be an extension for |
OK, so if that's ok, I'll start crafting a lint suggesting |
@flip1995 is right, this would be a natural extension to |
Great! 🎉
Oh yeah... Probably not a |
OK, I finally had some time for this issue. My idea is to extend the Can someone shed some light on And, as usual, any other comments are appreciated, since I'm not sure if the overall approach is correct. |
Hello,
During the review process of my recent PR there's been an idea to create a new lint for suggesting the usage of XOR when comparing bools, like so:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=b5bbd3c8e28e981aa80e02a372f242e9
I'd like to work on it, but before I start let me get your opinion. Is it worth implementing? Are the other similar "optimizations" that can be included in such a lint come to your mind?
Any ideas are appreciated.
Original comment:
Wait, these are bools. So we could use a XOR here
Originally posted by @flip1995 in https://github.com/_render_node/MDIzOlB1bGxSZXF1ZXN0UmV2aWV3VGhyZWFkMjIwMTAzMDk5OnYy/pull_request_review_threads/discussion
Alternative link: #4867 (comment)
The text was updated successfully, but these errors were encountered: