-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Dogfood trim_{suffix|prefix} in compiler
#148371
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
base: master
Are you sure you want to change the base?
Dogfood trim_{suffix|prefix} in compiler
#148371
Conversation
|
r? @fee1-dead rustbot has assigned @fee1-dead. Use |
| let (span, text) = match path.segments.first() { | ||
| Some(seg) if let Some(name) = seg.ident.as_str().strip_prefix("let") => { | ||
| // a special case for #117894 | ||
| let name = name.strip_prefix('_').unwrap_or(name); | ||
| (ident_span, format!("let {name}")) | ||
| } | ||
| _ => (ident_span.shrink_to_lo(), "let ".to_string()), | ||
| let (span, text) = if let Some(seg) = path.segments.first() | ||
| && let Some(name) = seg.ident.as_str().strip_prefix("let") | ||
| { | ||
| // a special case for #117894 | ||
| let name = name.trim_prefix('_'); | ||
| (ident_span, format!("let {name}")) | ||
| } else { | ||
| (ident_span.shrink_to_lo(), "let ".to_string()) | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like match is better here in term of readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit surprised, seemed like a clear win to me, but matter of style and taste obviously. It was a drive-by clean up so reverted it :)
eca96ee to
d28dcc7
Compare
|
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. |
|
@bors r+ rollup |
…uffix, r=fee1-dead
Dogfood `trim_{suffix|prefix}` in compiler
cc rust-lang#142312
Rollup of 5 pull requests Successful merges: - #145314 (Tweak output of missing lifetime on associated type) - #147803 (Add -Zannotate-moves for profiler visibility of move/copy operations (codegen)) - #147925 (Fix tests for big-endian) - #148341 (compiler: Fix a couple issues around cargo feature unification) - #148371 (Dogfood `trim_{suffix|prefix}` in compiler) r? `@ghost` `@rustbot` modify labels: rollup
cc #142312