Skip to content

Fix collapsible_if FP on block stmt before expr #14730

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

Merged
merged 1 commit into from
May 6, 2025

Conversation

profetia
Copy link
Contributor

@profetia profetia commented May 3, 2025

Closes #14722

changelog: [collapsible_if] fix FP on block stmt before expr

@rustbot
Copy link
Collaborator

rustbot commented May 3, 2025

r? @dswij

rustbot has assigned @dswij.
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 May 3, 2025
@Alexendoo
Copy link
Member

Nominating this to be in the same release as #14481 if needed

@Alexendoo Alexendoo added the beta-nominated Nominated for backporting to the compiler in the beta channel. label May 3, 2025
@samueltardieu
Copy link
Contributor

Nominating this to be in the same release as #14481 if needed

Thanks, this was indeed introduced (and not caught by existing checks) during the conversion into a late lint.

@samueltardieu
Copy link
Contributor

r? @samueltardieu

@rustbot rustbot assigned samueltardieu and unassigned dswij May 5, 2025
Copy link
Contributor

@samueltardieu samueltardieu left a comment

Choose a reason for hiding this comment

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

The fix looks complicated. It looks like there is a guard missing in expr_block(), adding it may be enough to fix the problem and would greatly simplify this PR:

     match block.stmts {
         [] => block.expr,
-        [stmt] => {
+        [stmt] if block.expr.is_none() => {

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels May 5, 2025
@rustbot

This comment has been minimized.

@profetia
Copy link
Contributor Author

profetia commented May 6, 2025

Thanks. Im changing it back now.

Copy link
Contributor

@samueltardieu samueltardieu 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

@samueltardieu samueltardieu added this pull request to the merge queue May 6, 2025
Merged via the queue into rust-lang:master with commit 7fdded3 May 6, 2025
11 checks passed
@flip1995
Copy link
Member

flip1995 commented May 8, 2025

Same as: #14733 (comment)

The likelihood of a beta backport right after the release increases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-nominated Nominated for backporting to the compiler in the beta channel. S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

collapsible_else_if lint false positive
6 participants