[perflint] Parenthesize walrus expressions in autofix for manual-list-comprehension (PERF401)#15050
Merged
dylwil3 merged 5 commits intoastral-sh:mainfrom Dec 19, 2024
Merged
Conversation
dylwil3
commented
Dec 18, 2024
crates/ruff_linter/src/rules/perflint/rules/manual_list_comprehension.rs
Show resolved
Hide resolved
Contributor
|
MichaReiser
approved these changes
Dec 19, 2024
dylwil3
pushed a commit
that referenced
this pull request
Jun 20, 2025
<!-- Thank you for contributing to Ruff/ty! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? (Please prefix with `[ty]` for ty pull requests.) - Does this pull request include references to any relevant issues? --> ## Summary <!-- What's the purpose of the change? What does it do, and why? --> While reading the docs I noticed this paragraph on `PERF401`. It was added in the same PR that the bug with `:=` was fixed, #15050, but don't know why it was added. The fix should already take care of adding the parenthesis, so having this paragraph in the docs is just confusing since it sounds like the user has to do something. ## Test Plan <!-- How was it tested? --> N/A, no tests/functionality affected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR ensures that, when transforming a for-loop into a comprehension for the rule manual-list-comprehension (PERF401), we parenthesize if-stmt tests when they are assignment expressions.
Closes #15047