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

chore: Inline format args #2024

Merged
merged 1 commit into from
Feb 5, 2024
Merged

Conversation

nyurik
Copy link
Contributor

@nyurik nyurik commented Nov 9, 2023

This makes the code a bit easier to read, and might result in a few minor perf optimizations (e.g. if Display trait is implemented, it might be better to make it part of the formatting). Also, i eliminated a few cases of using refs as format args - i.e. converted double-ref two single-ref, which is a 6% perf improvement (rustc cannot inline those for various reasons) - e.g. format!("{}", &foo) is more expensive than format!("{}", foo).

All these changes are safe for both 2018 and 2021 editions. The panic changes were moved to #2122

This makes the code a bit easier to read, and might result in a few minor perf optimizations (e.g. if Display trait is implemented, it might be better to make it part of the formatting)
@nyurik
Copy link
Contributor Author

nyurik commented Feb 3, 2024

@seanmonstar hi, this PR should be a noop, and no longer requires 2021 edition

@seanmonstar seanmonstar merged commit 2d6eb24 into seanmonstar:master Feb 5, 2024
31 checks passed
@nyurik nyurik deleted the inline-fmt branch February 5, 2024 14:27
Nutomic pushed a commit to Nutomic/reqwest that referenced this pull request Nov 7, 2024
This makes the code a bit easier to read, and might result in a few minor perf optimizations (e.g. if Display trait is implemented, it might be better to make it part of the formatting)
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.

2 participants