Skip to content

Commit c5ee385

Browse files
cakebakersylvestre
authored andcommitted
dircolors: simplify guess_syntax fn
1 parent d561443 commit c5ee385

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/uu/dircolors/src/dircolors.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// For the full copyright and license information, please view the LICENSE
44
// file that was distributed with this source code.
55

6-
// spell-checker:ignore (ToDO) clrtoeol dircolors eightbit endcode fnmatch leftcode multihardlink rightcode setenv sgid suid colorterm disp
6+
// spell-checker:ignore (ToDO) dircolors eightbit fnmatch setenv colorterm disp cshell
77

88
use std::borrow::Borrow;
99
use std::env;
@@ -43,12 +43,10 @@ fn guess_syntax<T: AsRef<Path>>(path: T) -> Option<OutputFmt> {
4343
return None;
4444
}
4545

46-
if let Some(name) = shell_path.file_name() {
47-
if name == "csh" || name == "tcsh" {
48-
Some(OutputFmt::CShell)
49-
} else {
50-
Some(OutputFmt::Shell)
51-
}
46+
let is_cshell = |name| name == "csh" || name == "tcsh";
47+
48+
if shell_path.file_name().is_some_and(is_cshell) {
49+
Some(OutputFmt::CShell)
5250
} else {
5351
Some(OutputFmt::Shell)
5452
}

0 commit comments

Comments
 (0)