ls: remove redundant HashMap lookup in append_raw_style_code_for_indicator

This commit is contained in:
Sylvestre Ledru
2026-01-08 14:28:54 +01:00
parent 98e0b31386
commit 224be498af
+4 -7
View File
@@ -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);
}
}