Просмотр исходного кода

refactor(output): simplify icon style setting in FileName.paint

Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
Sandro-Alessio Gierens 1 год назад
Родитель
Сommit
c612262294
1 измененных файлов с 1 добавлено и 4 удалено
  1. 1 4
      src/output/file_name.rs

+ 1 - 4
src/output/file_name.rs

@@ -203,10 +203,7 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {
         };
 
         if let Some(spaces_count) = spaces_count_opt {
-            let style = iconify_style(match self.colours.icon() {
-                Some(style) => style,
-                None => self.style(),
-            });
+            let style = iconify_style(self.colours.icon().unwrap_or_else(|| self.style()));
             let file_icon = icon_for_file(self.file).to_string();
             bits.push(style.paint(file_icon));
             bits.push(style.paint(" ".repeat(spaces_count as usize)));