Skip to content

Make question_mark to remove redundant block when outer scope will not be polluted - #16936

Open
profetia wants to merge 1 commit into
rust-lang:masterfrom
profetia:issue16892
Open

Make question_mark to remove redundant block when outer scope will not be polluted#16936
profetia wants to merge 1 commit into
rust-lang:masterfrom
profetia:issue16892

Conversation

@profetia

@profetia profetia commented Apr 30, 2026

Copy link
Copy Markdown
Member

Closes #16892

Implemented reusing the logic from match_single_binding.

changelog: [question_mark] remove redundant block when outer scope will not be polluted

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 30, 2026
@rustbot

rustbot commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

r? @Jarcho

rustbot has assigned @Jarcho.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: 7 candidates
  • 7 candidates expanded to 7 candidates
  • Random selection from Jarcho, dswij, llogiq

@profetia

Copy link
Copy Markdown
Member Author

r? clippy

@rustbot rustbot assigned dswij and unassigned Jarcho Jun 11, 2026
|

error: aborting due to 47 previous errors
error: aborting due to 51 previous errors

@dswij dswij Aug 8, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can we also add the case where there is a shadowing inside the block?

e.g.

    if let Some(x) = Some(1) {
        let x = x + 1;
        todo!()
    } else {
        return None;
    };

View changes since the review

@dswij dswij 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 Aug 8, 2026
@rustbot

rustbot commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (possibly #17607) made this pull request unmergeable. Please resolve the merge conflicts.

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

Labels

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.

question_mark suggestion has redundant block scope

4 participants