Skip to content

Conversation

ada4a
Copy link
Contributor

@ada4a ada4a commented Aug 15, 2025

For some reason I don't really understand, this lint was mushed together with needless_bool(_assign), even though they seemingly didn't have a lot of overlapping logic -- for one, their lint passes are separate, and can't be merged in a meaningful way.

I first wanted to move the file under booleans/ and move the common logic into utils.rs, and then split the files, but it turns out that the entirety of common logic was the fetch_bool_expr function, which is literally just expr.as_literal()?.as_bool(). So I scratched that idea, moved bool_comparison logic to a new file, and copy-pasted the function into it.

I think this change is advantageous in two main ways:

  1. no confusing intermingling of two different passes' logics
  2. the file that defines clippy::bool_comparison becomes easier to find, because now there's a file with that name.

This PR depends on #15498, but only for easier-rebase purposes.

changelog: none

@rustbot
Copy link
Collaborator

rustbot commented Aug 15, 2025

r? @llogiq

rustbot has assigned @llogiq.
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
Copy link

github-actions bot commented Aug 15, 2025

No changes for f0563ad

@rustbot rustbot added S-blocked Status: marked as blocked ❌ on something else such as an RFC or other implementation work A-lint Area: New lints and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Aug 15, 2025
@ada4a
Copy link
Contributor Author

ada4a commented Aug 15, 2025

I'm not^^ let's see if this will work..

@rustbot label S-waiting-on-review -A-lint -S-blocked

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties and removed A-lint Area: New lints S-blocked Status: marked as blocked ❌ on something else such as an RFC or other implementation work labels Aug 15, 2025
@samueltardieu
Copy link
Member

@rustbot note remove Feature-freeze

@ada4a ada4a force-pushed the bool-comparison-extract-file branch from a4b9011 to 58a850a Compare August 22, 2025 13:34
Copy link
Member

@samueltardieu samueltardieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r? samueltardieu
@rustbot blocked
(by #15513)

@rustbot rustbot assigned samueltardieu and unassigned llogiq Aug 22, 2025
@rustbot rustbot added S-blocked Status: marked as blocked ❌ on something else such as an RFC or other implementation work and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Aug 22, 2025
@rustbot

This comment has been minimized.

@ada4a ada4a force-pushed the bool-comparison-extract-file branch from 58a850a to f0563ad Compare August 22, 2025 21:50
@samueltardieu samueltardieu added this pull request to the merge queue Aug 23, 2025
Merged via the queue into rust-lang:master with commit 5ce5b89 Aug 23, 2025
11 checks passed
@ada4a ada4a deleted the bool-comparison-extract-file branch August 23, 2025 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-blocked Status: marked as blocked ❌ on something else such as an RFC or other implementation work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants