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

Lint x != _ || x != _ #853

Open
llogiq opened this issue Apr 12, 2016 · 3 comments
Open

Lint x != _ || x != _ #853

llogiq opened this issue Apr 12, 2016 · 3 comments
Assignees
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-correctness Lint: Belongs in the correctness lint group T-middle Type: Probably requires verifiying types

Comments

@llogiq
Copy link
Contributor

llogiq commented Apr 12, 2016

Also probably x == _ && x == _. This is either a duplicate (if both _ are equal) or always false (true for the former).

@llogiq llogiq self-assigned this Apr 12, 2016
@llogiq llogiq added good-first-issue These issues are a good way to get started with Clippy T-middle Type: Probably requires verifiying types A-lint Area: New lints labels Apr 12, 2016
@oli-obk
Copy link
Contributor

oli-obk commented Apr 13, 2016

we could probably let the logic_bug lint catch this. If the _ are equal, it's already caught. If they differ, we can add some logic to merge them into the same terminal and see if that eliminates any terminals.

@mcarton mcarton added the L-correctness Lint: Belongs in the correctness lint group label Jul 2, 2016
@felix91gr
Copy link
Contributor

What happened to this lint? Did it become part of logic_bug, @oli-obk?

@oli-obk
Copy link
Contributor

oli-obk commented Apr 7, 2020

nope. It was never integrated. We need to be careful which values we convert to the same terminal. E.g. x == foo() && x == bar() may easily be true, this trick should only be applied if the _ is a literal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-correctness Lint: Belongs in the correctness lint group T-middle Type: Probably requires verifiying types
Projects
None yet
Development

No branches or pull requests

6 participants