diff --git a/src/uu/ls/src/colors.rs b/src/uu/ls/src/colors.rs index 8eb4b7097..fc481eab0 100644 --- a/src/uu/ls/src/colors.rs +++ b/src/uu/ls/src/colors.rs @@ -129,14 +129,11 @@ impl<'a> StyleManager<'a> { indicator: Indicator, style_code: &mut String, ) { - if !self.indicator_codes.contains_key(&indicator) { - return; - } - style_code.push_str(self.reset(!self.initial_reset_is_done)); - style_code.push_str(ANSI_CSI); - if let Some(raw) = self.indicator_codes.get(&indicator) { + if let Some(raw) = self.indicator_codes.get(&indicator).cloned() { debug_assert!(!raw.is_empty()); - style_code.push_str(raw); + style_code.push_str(self.reset(!self.initial_reset_is_done)); + style_code.push_str(ANSI_CSI); + style_code.push_str(&raw); style_code.push_str(ANSI_SGR_END); } }