From d64f6696a5dfbbce61f4952ba6c5e2b690894475 Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Tue, 12 Sep 2023 14:42:57 +0800 Subject: [PATCH] fix(anstyle-termcolor): set effect correctly for transformations --- crates/anstyle-termcolor/src/lib.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/crates/anstyle-termcolor/src/lib.rs b/crates/anstyle-termcolor/src/lib.rs index 65568ee5..d99a28c2 100644 --- a/crates/anstyle-termcolor/src/lib.rs +++ b/crates/anstyle-termcolor/src/lib.rs @@ -22,18 +22,10 @@ pub fn to_termcolor_spec(style: anstyle::Style) -> termcolor::ColorSpec { let mut style = termcolor::ColorSpec::new(); style.set_fg(fg); style.set_bg(bg); - if effects.contains(anstyle::Effects::BOLD) { - style.bold(); - } - if effects.contains(anstyle::Effects::DIMMED) { - style.dimmed(); - } - if effects.contains(anstyle::Effects::ITALIC) { - style.italic(); - } - if effects.contains(anstyle::Effects::UNDERLINE) { - style.underline(); - } + style.set_bold(effects.contains(anstyle::Effects::BOLD)); + style.set_dimmed(effects.contains(anstyle::Effects::DIMMED)); + style.set_italic(effects.contains(anstyle::Effects::ITALIC)); + style.set_underline(effects.contains(anstyle::Effects::UNDERLINE)); style }