From c5ee3852fd73a665ffa2f48e6b523df9f4a2dc77 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sun, 31 May 2026 17:08:34 +0200 Subject: [PATCH] dircolors: simplify guess_syntax fn --- src/uu/dircolors/src/dircolors.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/uu/dircolors/src/dircolors.rs b/src/uu/dircolors/src/dircolors.rs index d37760b43..311aa3af9 100644 --- a/src/uu/dircolors/src/dircolors.rs +++ b/src/uu/dircolors/src/dircolors.rs @@ -3,7 +3,7 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// spell-checker:ignore (ToDO) clrtoeol dircolors eightbit endcode fnmatch leftcode multihardlink rightcode setenv sgid suid colorterm disp +// spell-checker:ignore (ToDO) dircolors eightbit fnmatch setenv colorterm disp cshell use std::borrow::Borrow; use std::env; @@ -43,12 +43,10 @@ fn guess_syntax>(path: T) -> Option { return None; } - if let Some(name) = shell_path.file_name() { - if name == "csh" || name == "tcsh" { - Some(OutputFmt::CShell) - } else { - Some(OutputFmt::Shell) - } + let is_cshell = |name| name == "csh" || name == "tcsh"; + + if shell_path.file_name().is_some_and(is_cshell) { + Some(OutputFmt::CShell) } else { Some(OutputFmt::Shell) }