diff options
author | Narawit Rakket <narawitrakket@hotmail.com> | 2022-07-05 22:18:59 +0700 |
---|---|---|
committer | Abin Simon <abinsimon10@gmail.com> | 2022-07-09 17:27:32 +0530 |
commit | 73b14ab8c4cd3eb2fcd9f4e3d7a20551f4a36dae (patch) | |
tree | 0cba68857dd5e4d907f9fb0055f386823cc2e735 | |
parent | 853fcb6fbfe8e1c48315f3165823e9af7a91ae19 (diff) |
refactor: merge `match` branches with the same output
-rw-r--r-- | src/color.rs | 14 |
1 files 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"), }, |