Skip to content
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

Avoid ref when using format! in compiler #17641

Merged
merged 2 commits into from
Jul 20, 2024
Merged

Conversation

nyurik
Copy link
Contributor

@nyurik nyurik commented Jul 19, 2024

Clean up a few minor refs in format! macro, as it has a performance cost. Apparently the compiler is unable to inline format!("{}", &variable), and does a run-time double-reference instead (format macro already does one level referencing). Inlining format args prevents accidental & misuse.

See rust-lang/rust-clippy#10851

Clean up a few minor refs in `format!` macro, as it has a performance cost. Apparently the compiler is unable to inline `format!("{}", &variable)`, and does a run-time double-reference instead (format macro already does one level referencing). Inlining format args prevents accidental `&` misuse.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 19, 2024
crates/ide/src/rename.rs Outdated Show resolved Hide resolved
@Veykril
Copy link
Member

Veykril commented Jul 20, 2024

Thanks!
@bors r

@bors
Copy link
Collaborator

bors commented Jul 20, 2024

📌 Commit 3092e1c has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jul 20, 2024

⌛ Testing commit 3092e1c with merge 062822c...

@bors
Copy link
Collaborator

bors commented Jul 20, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 062822c to master...

@bors bors merged commit 062822c into rust-lang:master Jul 20, 2024
11 checks passed
@nyurik nyurik deleted the optimize-refs branch July 20, 2024 06:55
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.

None yet

4 participants