Skip to content

Commit 3e82dca

Browse files
committed
Optimize fmt::PadAdapter::wrap
1 parent 99f8efe commit 3e82dca

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

library/core/src/fmt/builders.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ impl<'buf, 'state> PadAdapter<'buf, 'state> {
2323
slot: &'slot mut Option<Self>,
2424
state: &'state mut PadAdapterState,
2525
) -> fmt::Formatter<'slot> {
26-
fmt.wrap_buf(move |buf| {
27-
*slot = Some(PadAdapter { buf, state });
28-
slot.as_mut().unwrap()
29-
})
26+
fmt.wrap_buf(move |buf| slot.insert(PadAdapter { buf, state }))
3027
}
3128
}
3229

0 commit comments

Comments
 (0)