Skip to content

Commit

Permalink
chore: Update Styled pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Mar 14, 2023
1 parent 1e7640c commit 28ea6ae
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/color.rs
Expand Up @@ -45,13 +45,10 @@ impl<D: std::fmt::Display> std::fmt::Display for Styled<D> {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
if f.alternate() {
write!(
f,
"{}{}{}",
self.style.render(),
self.display,
self.style.render_reset()
)
write!(f, "{}", self.style.render())?;
self.display.fmt(f)?;
write!(f, "{}", self.style.render_reset())?;
Ok(())
} else {
self.display.fmt(f)
}
Expand Down

0 comments on commit 28ea6ae

Please sign in to comment.