Skip to content

Suggest local variables for captured format args#152097

Open
JohnTitor wants to merge 1 commit intorust-lang:mainfrom
JohnTitor:issue-114108
Open

Suggest local variables for captured format args#152097
JohnTitor wants to merge 1 commit intorust-lang:mainfrom
JohnTitor:issue-114108

Conversation

@JohnTitor
Copy link
Member

Fixes #114108

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 4, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 4, 2026

r? @BoxyUwU

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

@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Feb 11, 2026

This PR was rebased onto a different main 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.

@BoxyUwU
Copy link
Member

BoxyUwU commented Feb 14, 2026

Judging by the test changes this doesn't feel like a big diagnostic improvement. The suggested code changes are often larger/more verbose than before and if I was reviewing code where somebody followed those suggestions I would tell them to rewrite it.

Adding a note that says "consider moving this expression to a local variable and then using the local here instead" would be relatively small and teach people how things work without it being the main suggestion of the diagnostic. I think I would prefer that

@BoxyUwU
Copy link
Member

BoxyUwU commented Feb 14, 2026

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 14, 2026
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 (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider suggesting local variables for invalid format expressions

4 participants