From 8ee5b783b3ae11f48f623186b2f6b37d174dda27 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Fri, 12 Jul 2024 17:16:07 +0900 Subject: [PATCH] formatter: minor cleanup in --color=debug handling --- cli/src/formatter.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/src/formatter.rs b/cli/src/formatter.rs index 478238a3d..4bbbe6570 100644 --- a/cli/src/formatter.rs +++ b/cli/src/formatter.rs @@ -284,7 +284,7 @@ impl ColorFormatter { labels: vec![], cached_styles: HashMap::new(), current_style: Style::default(), - current_debug: if debug { Some(String::new()) } else { None }, + current_debug: debug.then(String::new), } } @@ -340,7 +340,7 @@ impl ColorFormatter { let new_debug = match &self.current_debug { Some(current) => { let joined = self.labels.join(" "); - if joined.eq(current) { + if joined == *current { None } else { if !current.is_empty() {