Skip to content

Suggest explicit bool ops for unnecessary_fold - #17801

Draft
beriktassuly wants to merge 1 commit into
rust-lang:masterfrom
beriktassuly:unnecessary-fold-bool-ops
Draft

beriktassuly wants to merge 1 commit into
rust-lang:masterfrom
beriktassuly:unnecessary-fold-bool-ops

Conversation

@beriktassuly

@beriktassuly beriktassuly commented Sep 27, 2026 •

Copy link
Copy Markdown

Fixes #17792.

This changes bool unnecessary_fold diagnostics to suggest an explicit non-short-circuiting | or & fold when the current closure uses || or &&, while still noting any/all for cases where short-circuiting is intended.

changelog: [unnecessary_fold]: Suggest explicit non-short-circuiting bool ops for boolean folds that use || or &&.

Tested with:

TESTNAME=unnecessary_fold cargo uitest

@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 Sep 27, 2026
@rustbot

rustbot commented Sep 27, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome!

You should hear from one of our reviewers after this PR gets at least 2 reviews from the community.

Please see the contribution instructions for more information.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 27, 2026
@beriktassuly
beriktassuly force-pushed the unnecessary-fold-bool-ops branch from 9c76400 to d1a6159 Compare September 27, 2026 16:07
@beriktassuly
beriktassuly force-pushed the unnecessary-fold-bool-ops branch from d1a6159 to 53ddfa3 Compare September 27, 2026 16:19

@CommanderStorm CommanderStorm left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Community review:
Why is there all of this stuff added.. Can you please comment why you added this inline?

The conclusion on the issue was that adding an diagnostic and marking this as MaybeIncorrect is a good solution.

Also, given that you have included how you tested things in your description (plus changes seem not quite related)..
Please read our LLM usage policy and see if you followed it.

View changes since this review

@beriktassuly

Copy link
Copy Markdown
Author

hmm yep, you're right I need to check all properly. I will make it a draft for now

@beriktassuly
beriktassuly marked this pull request as draft September 28, 2026 10:08
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 28, 2026

This branch has not been deployed

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

Labels

S-waiting-on-community-reviews Status: This is awaiting for positive reviews from the community before a maintainer is assigned.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unnecessary_fold: suggest bool bitwise ops

3 participants