diff --git a/examples/custom_format.rs b/examples/custom_format.rs index 8f575fd..80b9aaa 100644 --- a/examples/custom_format.rs +++ b/examples/custom_format.rs @@ -33,13 +33,11 @@ fn main() { // We are reusing `anstyle` but there are `anstyle-*` crates to adapt it to your // preferred styling crate. let warn_style = buf.default_level_style(log::Level::Warn); - let reset = warn_style.render_reset(); - let warn_style = warn_style.render(); let timestamp = buf.timestamp(); writeln!( buf, - "My formatted log ({timestamp}): {warn_style}{}{reset}", + "My formatted log ({timestamp}): {warn_style}{}{warn_style:#}", record.args() ) }) diff --git a/src/fmt/mod.rs b/src/fmt/mod.rs index faee69b..b7aa4ac 100644 --- a/src/fmt/mod.rs +++ b/src/fmt/mod.rs @@ -251,14 +251,13 @@ struct StyledValue { #[cfg(feature = "color")] impl std::fmt::Display for StyledValue { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let style = self.style.render(); - let reset = self.style.render_reset(); + let style = self.style; // We need to make sure `f`s settings don't get passed onto the styling but do get passed // to the value write!(f, "{style}")?; self.value.fmt(f)?; - write!(f, "{reset}")?; + write!(f, "{style:#}")?; Ok(()) } }