I tried this code: ```rust pub fn func(i: i32) -> String { format!("{}", &i) } ``` I expected `&i` to be inlined and be equivalent to `format!("{}", i)` Instead, in my [benchmarking tests](https://gist.github.com/nyurik/16495ecf3034052803ceb1b26b8ac8a9) I see about 6% performance hit, and [assembly](https://rust.godbolt.org/z/M7KxPGYE9) has a non-inlined function.  ### Relevant links * [Assembly comparison](https://rust.godbolt.org/z/M7KxPGYE9) * [Benchmarking code](https://gist.github.com/nyurik/16495ecf3034052803ceb1b26b8ac8a9) * A Clippy lint: https://github.com/rust-lang/rust-clippy/issues/10851 * [Stackoverflow question](https://stackoverflow.com/questions/76361472/why-formatting-value-vs-ref-generates-different-assembly-in-rust) ### Meta <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --> `rustc --version --verbose`: ``` rustc 1.69.0 (84c898d65 2023-04-16) binary: rustc commit-hash: 84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc commit-date: 2023-04-16 host: x86_64-unknown-linux-gnu release: 1.69.0 LLVM version: 15.0.7 ```
I tried this code:
I expected
&ito be inlined and be equivalent toformat!("{}", i)Instead, in my benchmarking tests I see about 6% performance hit, and assembly has a non-inlined function.
Relevant links
Meta
rustc --version --verbose: