Skip to content

bool_comparison: no longer lint on !x != y #15498

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

ada4a
Copy link
Contributor

@ada4a ada4a commented Aug 15, 2025

The issue that this PR was opened to fix (#15367), talked about how, for !x == false, this lint suggests both:

  1. x != false
  2. x

I initially wanted to make the lint short-circuit after emitting the first suggestion (since that was the easier change code-wise), but that was not optimal for two reasons:

  1. suggestion 2 is obviously better (the other one requires one more round of Clippy)
  2. suggestion 1 is actually already covered by nonminimal_bool

And so I instead decided to completely remove the code path that emits suggestion 1.

Fixes #15367

changelog: [bool_comparison]: no longer lint on !x != y

@rustbot
Copy link
Collaborator

rustbot commented Aug 15, 2025

r? @Jarcho

rustbot has assigned @Jarcho.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bool_comparison triggers twice on the same code
3 participants