Optimize fmt::PadAdapter::wrap

This commit is contained in:
phlopsi 2021-07-11 06:41:43 +02:00 committed by Phlopsi
parent 99f8efec46
commit 3e82dca65c

View file

@ -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 }))
}
}