From 3e82dca65c226324580db910b2609e8dce1850ac Mon Sep 17 00:00:00 2001 From: phlopsi Date: Sun, 11 Jul 2021 06:41:43 +0200 Subject: [PATCH] Optimize fmt::PadAdapter::wrap --- library/core/src/fmt/builders.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/library/core/src/fmt/builders.rs b/library/core/src/fmt/builders.rs index b660788c0515f..8e7b03d02f157 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, 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 })) } }