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 wrong integer range comparisons #1110

Closed
Boddlnagg opened this issue Jul 20, 2016 · 0 comments · Fixed by #6177
Closed

Lint wrong integer range comparisons #1110

Boddlnagg opened this issue Jul 20, 2016 · 0 comments · Fixed by #6177
Labels
A-lint Area: New lints E-medium Call for participation: Medium difficulty level problem and requires some initial experience. T-middle Type: Probably requires verifiying types

Comments

@Boddlnagg
Copy link

I don't know if an issue already exists for something like this, but at least I couldn't find one:
I suggest to add a lint that checks for conditions such as

  • i > A || i < B where A and B are integer literals (or constants?) with AB (always true)
  • i < A && i > B where A and B are integer literals (or constants?) with AB (always false)

After rust-lang/rust#32311 is stabilized, clippy could also suggest to use Range::contains.

@mcarton mcarton added E-medium Call for participation: Medium difficulty level problem and requires some initial experience. T-middle Type: Probably requires verifiying types A-lint Area: New lints L-style Lint: Belongs in the style lint group and removed L-style Lint: Belongs in the style lint group labels Jul 21, 2016
@bors bors closed this as completed in 90cb25d Oct 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints E-medium Call for participation: Medium difficulty level problem and requires some initial experience. T-middle Type: Probably requires verifiying types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants