chore: Update Styled pattern

This commit is contained in:
Ed Page 2023-03-14 08:22:10 -05:00
parent dc0eafc7e5
commit 9504315f7e

View file

@ -53,13 +53,10 @@ impl<D: std::fmt::Display> std::fmt::Display for Styled<D> {
#[inline] #[inline]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
if f.alternate() { if f.alternate() {
write!( write!(f, "{}", self.style.render())?;
f, self.display.fmt(f)?;
"{}{}{}", write!(f, "{}", self.style.render_reset())?;
self.style.render(), Ok(())
self.display,
self.style.render_reset()
)
} else { } else {
self.display.fmt(f) self.display.fmt(f)
} }