Skip to content

Preserve the order of Clippy fixes for nested matches! and boolean conditions - #92

Open
charliermarsh wants to merge 5 commits into
charlie/keep-owned-comparison-suggestions-togetherfrom
charlie/keep-nested-boolean-fixes-in-order
Open

charliermarsh wants to merge 5 commits into
charlie/keep-owned-comparison-suggestions-togetherfrom
charlie/keep-nested-boolean-fixes-in-order

Conversation

@charliermarsh

@charliermarsh charliermarsh commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

For a nested Boolean expression, Clippy can suggest simplifying both a match and the comparison inside it. Running the lints in separate traversals can reverse the edits and turn !(n == 1) into !n == 1.

We now check Boolean conditionals, comparisons, redundant patterns and identity matches in the same traversal. We also record source reads when a comment or conditional arm prevents a suggestion, so editing that text can make the suggestion reappear.

The original fixer replay preserved the truth tables of all 106 generated Boolean expressions and matched stock Clippy on 225 numeric and optional-value expressions.

Closes #91.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant