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

rust: Inline format args #1030

Open
wants to merge 1 commit into
base: rust
Choose a base branch
from

Conversation

nyurik
Copy link

@nyurik nyurik commented Aug 15, 2023

A minor Rust cleanup to inline format!("foo={}", foo) and similar macro calls into format!("foo={foo}").

While mostly cosmetic, this change makes it a bit easier to read format argument strings, shortens code, and makes it easier to see cases with double-referencing values causing minor performance (apparently &foo in a format! causes about 6% perf cost due to Rust compiler being unable to inline it due to dynamic invocation.

A minor Rust cleanup to inline `format!("{}", foo)` and similar macro calls into `format!("{foo}")`.

While mostly cosmetic, this change makes it a bit easier to read format argument strings, shortens code, and makes it easier to see cases with double-referencing values causing minor performance (apparently `&foo` in a format! causes about 6% perf cost due to Rust compiler being unable to inline it due to dynamic invocation.
@ojeda
Copy link
Member

ojeda commented Aug 15, 2023

Thanks for the PR! Development/changes should be submitted to the mailing list (please see https://rust-for-linux.com/contributing).

@nyurik
Copy link
Author

nyurik commented Aug 15, 2023

Thanks @ojeda, I tried looking through all those numerous guides and got really lost. Is there a simple short tutorial that walks one step by step with as little text as possible? As someone once said, it is simple to explain something in a difficult way, but it is very difficult to explain it simply :)

@ojeda
Copy link
Member

ojeda commented Aug 15, 2023

My pleasure Yuri!

Yeah, it can be a bit overwhelming at first. In the webpage I give a pointer to Documentation/process/submitting-patches.rst, which is a single document which explains the basics and what you need to do to post the patch (i.e. the steps/commands involved, how to write a proper commit message, etc.). Did you take a look at that one? (since you mention "numerous guides", I am not sure which you read).

If something does not seem to work, then please feel free to ask in e.g. our Zulip for help on the process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants