Skip to content

Conversation

ada4a
Copy link
Contributor

@ada4a ada4a commented Sep 21, 2025

changelog: none

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

rustbot commented Sep 21, 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

Comment on lines 151 to 157
.map(|(_, arm)| snippet_opt(cx, arm.pat.span))
.collect::<Option<Vec<_>>>()
{
let mut suggs = src
let suggs = src
.iter()
.map(|(_, arm)| (adjusted_arm_span(cx, arm.span), String::new()))
.chain([(dest.pat.span, pat_snippets.iter().join(" | "))])
Copy link
Contributor

Choose a reason for hiding this comment

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

snippet_opt is probably going to be removed at some point. Note that get_source_text does not allocate a temporary string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, I remember hearing something like that. Would it make sense to mark snippet_opt as #[deprecated] then?

Copy link
Contributor

@Jarcho Jarcho Sep 21, 2025

Choose a reason for hiding this comment

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

That's waiting on a cleanup PR to be merged.

That isn't really doable without an annoyingly large number of allows.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why allows? Can't one basically always replace snippet_opt with get_source_text? Well unless you do need a String, but that's just an added .to_owned()

Copy link
Contributor

Choose a reason for hiding this comment

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

if all the uses are going to be replaced then it can just be removed instead of deprecated.

@blyxyas blyxyas added this pull request to the merge queue Sep 30, 2025
Merged via the queue into rust-lang:master with commit e74d4bd Sep 30, 2025
11 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 30, 2025
@ada4a ada4a deleted the match-same-arms branch October 5, 2025 16:57
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.

4 participants