diff options
| author | phlopsi <nbphobos@gmail.com> | 2021-07-11 06:41:43 +0200 |
|---|---|---|
| committer | Phlopsi <nbphobos@gmail.com> | 2021-07-11 08:06:29 +0200 |
| commit | 3e82dca65c226324580db910b2609e8dce1850ac (patch) | |
| tree | 7dccb49fcc86d5aa9e7faacb55da2de51008736b | |
| parent | 99f8efec46c72cb11418f858ae142baa5f3582a9 (diff) | |
| download | rust-3e82dca65c226324580db910b2609e8dce1850ac.tar.gz rust-3e82dca65c226324580db910b2609e8dce1850ac.zip | |
Optimize fmt::PadAdapter::wrap
| -rw-r--r-- | library/core/src/fmt/builders.rs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/library/core/src/fmt/builders.rs b/library/core/src/fmt/builders.rs index b660788c051..8e7b03d02f1 100644 --- a/library/core/src/fmt/builders.rs +++ b/library/core/src/fmt/builders.rs @@ -23,10 +23,7 @@ impl<'buf, 'state> PadAdapter<'buf, 'state> { slot: &'slot mut Option<Self>, state: &'state mut PadAdapterState, ) -> fmt::Formatter<'slot> { - fmt.wrap_buf(move |buf| { - *slot = Some(PadAdapter { buf, state }); - slot.as_mut().unwrap() - }) + fmt.wrap_buf(move |buf| slot.insert(PadAdapter { buf, state })) } } |
