Skip to content

Fix collapsible_match suggests wrongly when match body has no braces#16749

Open
profetia wants to merge 1 commit intorust-lang:masterfrom
profetia:issue16717
Open

Fix collapsible_match suggests wrongly when match body has no braces#16749
profetia wants to merge 1 commit intorust-lang:masterfrom
profetia:issue16717

Conversation

@profetia
Copy link
Copy Markdown
Member

@profetia profetia commented Mar 23, 2026

Closes #16716
Closes #16894

changelog: [collapsible_match] fix wrong suggestions when match body has no braces

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Mar 23, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 23, 2026

r? @samueltardieu

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 23, 2026

No changes for 691fbb4

@profetia
Copy link
Copy Markdown
Member Author

Also fixes #16716

@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@profetia
Copy link
Copy Markdown
Member Author

r? clippy

@samueltardieu
Copy link
Copy Markdown
Member

I think #16749 has some merit and is a better test (all following alternatives in a match are wildcards).

@profetia
Copy link
Copy Markdown
Member Author

Do you mean #16878?

@samueltardieu
Copy link
Copy Markdown
Member

Do you mean #16878?

Yes

@profetia
Copy link
Copy Markdown
Member Author

Closed in favor of #16878

@profetia profetia closed this Apr 20, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 20, 2026
@profetia
Copy link
Copy Markdown
Member Author

Reopened to fix #16716 solely

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

This comment has been minimized.

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 20, 2026

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@profetia profetia changed the title Fix collapsible_match FP when the scrutinee could match a later pattern Fix collapsible_match suggests wrongly when match body has no braces Apr 20, 2026
@profetia
Copy link
Copy Markdown
Member Author

Restructured to fix #16716 solely, as #16717 is already fixed by another PR

@profetia
Copy link
Copy Markdown
Member Author

Also closes #16894

Copy link
Copy Markdown
Member

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

Could you please include the reproduction code of #16894 as a test, as well as a combination of strangely formatted match arms, to ensure none is going to cause an issue?

View changes since this review

@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 Apr 21, 2026
@profetia
Copy link
Copy Markdown
Member Author

Added. Thank you!

@profetia profetia requested a review from samueltardieu April 22, 2026 17:12
@profetia
Copy link
Copy Markdown
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties and removed S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Apr 22, 2026
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::collapsible_match code suggestion is not valid Rust collapsible_match generates invalid suggestion when match arm does not have {}

4 participants