rust/library
Yuki Okushi c25b979db6
Rollup merge of #87052 - phlopsi:patch-1, r=jyn514
Optimize fmt::PadAdapter::wrap

After adding the first `write!` usage to my project and printing the result to the console, I noticed, that my binary contains the strings "called `Option::unwrap()` on a `None` value`" and more importantly "C:\Users\Patrick Fischer\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\fmt\builders.rs", with my release build being configured as follows:
```
[profile.release]
panic = "abort"
codegen-units = 1
strip = "symbols" # the important bit
lto = true
```
I am in a no_std environment and my custom panic handler is a simple `loop {}`. I did not expect the above information to be preserved. I heavily suspect the edited function to be the culprit. It contains the only direct use of `Option::unwrap` in the entire file and I tracked the symbols in the assembly to be used from the section `_ZN68_$LT$core..fmt..builders..PadAdapter$u20$as$u20$core..fmt..Write$GT$9write_str17ha1d5e5efe167202aE`.

Aside from me suspecting this function to be the culprit, the replaced code performs the same operation as `Option::insert`, but without the `unreachable_unchecked` optimization `Option::insert` provides. Therefore, it makes sense to me to use the more optimized version, instead.

As I don't change any semantics, I hope a simple pull request suffices.
2021-07-30 16:26:52 +09:00
..
alloc Fix may not to appropriate might not or must not 2021-07-29 01:15:20 -04:00
backtrace@221483ebaf
core Rollup merge of #87052 - phlopsi:patch-1, r=jyn514 2021-07-30 16:26:52 +09:00
panic_abort Fix may not to appropriate might not or must not 2021-07-29 01:15:20 -04:00
panic_unwind Remove the deprecated core::raw and std::raw module. 2021-07-03 14:03:27 +08:00
proc_macro Fix may not to appropriate might not or must not 2021-07-29 01:15:20 -04:00
profiler_builtins Upgrade cc crate to 1.0.69 2021-07-13 17:58:50 +09:00
rtstartup
rustc-std-workspace-alloc
rustc-std-workspace-core
rustc-std-workspace-std
std Auto merge of #87445 - amalik18:issue-83584-fix, r=kennytm 2021-07-30 04:34:13 +00:00
stdarch@3001c75a1d
test Remove unused stuff and switch to pub(crate) whenever possible. 2021-07-18 22:00:41 +08:00
unwind Upgrade cc crate to 1.0.69 2021-07-13 17:58:50 +09:00