Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix obfuscated_if_else suggestion on left side of a binary expr #14124

Merged
merged 2 commits into from
Feb 9, 2025

Conversation

samueltardieu
Copy link
Contributor

An if … { … } else { … } used as the left operand of a binary expression requires parentheses to be parsed as an expression.

Fix #11141

changelog: [obfuscated_if_else]: fix bug in suggestion by issuing required parentheses around the left side of a binary expression

@rustbot
Copy link
Collaborator

rustbot commented Jan 31, 2025

r? @blyxyas

rustbot has assigned @blyxyas.
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 Jan 31, 2025
Copy link
Member

@blyxyas blyxyas left a comment

Choose a reason for hiding this comment

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

It's looking pretty good! Could you add error annotations?

Copy link
Member

Choose a reason for hiding this comment

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

Could you add the //~ ui_test annotations?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be ok now

An `if … { … } else { … }` used as the left operand of a binary
expression requires parentheses to be parsed as an expression.
Copy link
Member

@blyxyas blyxyas left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! ❤️

@blyxyas blyxyas added this pull request to the merge queue Feb 9, 2025
Merged via the queue into rust-lang:master with commit 8c01600 Feb 9, 2025
11 checks passed
@samueltardieu samueltardieu deleted the push-sxuslxyxnzlz branch February 9, 2025 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

clippy::obfuscated_if_else fix fails
3 participants