From 73b14ab8c4cd3eb2fcd9f4e3d7a20551f4a36dae Mon Sep 17 00:00:00 2001 From: Narawit Rakket Date: Tue, 5 Jul 2022 22:18:59 +0700 Subject: [PATCH] refactor: merge `match` branches with the same output --- src/color.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/color.rs b/src/color.rs index 784f223..e401708 100644 --- a/src/color.rs +++ b/src/color.rs @@ -139,13 +139,13 @@ impl Colors { pub fn new(t: ThemeOption) -> Self { let theme = match t { ThemeOption::NoColor => None, - ThemeOption::Default => Some(Theme::default()), - ThemeOption::NoLscolors => Some(Theme::default()), + ThemeOption::Default | ThemeOption::NoLscolors => Some(Theme::default()), ThemeOption::Custom(ref file) => Some(Theme::from_path(file).unwrap_or_default()), }; let lscolors = match t { - ThemeOption::Default => Some(LsColors::from_env().unwrap_or_default()), - ThemeOption::Custom(_) => Some(LsColors::from_env().unwrap_or_default()), + ThemeOption::Default | ThemeOption::Custom(_) => { + Some(LsColors::from_env().unwrap_or_default()) + } _ => None, }; @@ -222,11 +222,7 @@ impl Colors { Elem::CharDevice => Some("cd"), Elem::BrokenSymLink => Some("or"), Elem::MissingSymLinkTarget => Some("mi"), - Elem::INode { valid } => match valid { - true => Some("so"), - false => Some("no"), - }, - Elem::Links { valid } => match valid { + Elem::INode { valid } | Elem::Links { valid } => match valid { true => Some("so"), false => Some("no"), },