Skip to content

Conversation

@ada4a
Copy link
Contributor

@ada4a ada4a commented Oct 21, 2025

  • Make the diagnostic message actually desribe the problem
  • Make the suggestion verbose, because we lint multiline exprs

changelog: [match_as_ref]: improve diagnostics

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Oct 21, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 21, 2025

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

Copy link
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.

Note that this doesn't fix the bug in:

    let _: Option<&u32> = match Some(0) {
        //~^ match_as_ref
        None => None,
        Some(ref mut v) => Some(v),
    };

which will propose an incorrect fix.

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 Oct 21, 2025
@ada4a
Copy link
Contributor Author

ada4a commented Oct 21, 2025

@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 Oct 21, 2025
@ada4a ada4a changed the title refactor(match_as_ref): improve diagnostics match_as_ref: improve diagnostics Oct 21, 2025
@samueltardieu samueltardieu added this pull request to the merge queue Oct 21, 2025
Merged via the queue into rust-lang:master with commit 039b40f Oct 21, 2025
13 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Oct 21, 2025
@ada4a ada4a deleted the match_as_ref branch October 21, 2025 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants