Skip to content

Add ifs_as_logical_ops lint#17449

Open
ada4a wants to merge 2 commits into
rust-lang:masterfrom
ada4a:ifs-as-logical-ops
Open

Add ifs_as_logical_ops lint#17449
ada4a wants to merge 2 commits into
rust-lang:masterfrom
ada4a:ifs-as-logical-ops

Conversation

@ada4a

@ada4a ada4a commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

This PR supersedes #14904. All the content is kept the same, apart from some small changes:

The original description follows:

Fixes #14865 by adding the ifs_as_logical_ops lint.

Only adds the conjunctive version (transform if x else y => x && y) for now.

changelog: [ifs_as_logical_ops] : "Warn about cases where x && y could be used in place of if conditions"

Co-authored-by: Ada Alakbarova <ada.alakbarova@proton.me>
@rustbot rustbot added the S-waiting-on-community-reviews Status: This is awaiting for positive reviews from the community before a maintainer is assigned. label Jul 24, 2026
@rustbot

rustbot commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request. A reviewer will take a look after it receives 2 community reviews.

In the meantime, we would highly appreciate if you could try to review any of PRs waiting on community reviews.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added needs-fcp PRs that add, remove, or rename lints and need an FCP S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Jul 24, 2026
Co-authored-by: Ada Alakbarova <ada.alakbarova@proton.me>
@ada4a
ada4a force-pushed the ifs-as-logical-ops branch from ea08daf to 5ee07f1 Compare July 24, 2026 13:39
@ada4a

ada4a commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

The original PR was reviewed to bits already, so going through community review yet again might be superfluous. Let me assign a reviewer, and see what they think.

r? clippy

@rustbot rustbot removed the S-waiting-on-community-reviews Status: This is awaiting for positive reviews from the community before a maintainer is assigned. label Jul 24, 2026
@github-actions

Copy link
Copy Markdown

Lintcheck changes for 5ee07f1

Lint Added Removed Changed
clippy::ifs_as_logical_ops 5 0 0

This comment will be updated if you push new changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-fcp PRs that add, remove, or rename lints and need an FCP 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.

Suggest A && B for if A { B } else { false }

4 participants