From 3c7940ddfd1ac751bc1bf4c71d09706437294b14 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Sun, 25 Jul 2021 16:22:22 -0400 Subject: [PATCH] pathchk: remove double negation --- src/uu/pathchk/src/pathchk.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/uu/pathchk/src/pathchk.rs b/src/uu/pathchk/src/pathchk.rs index 335266456..7f728667f 100644 --- a/src/uu/pathchk/src/pathchk.rs +++ b/src/uu/pathchk/src/pathchk.rs @@ -170,7 +170,7 @@ fn check_basic(path: &[String]) -> bool { fn check_extra(path: &[String]) -> bool { // components: leading hyphens for p in path { - if !no_leading_hyphen(p) { + if p.starts_with('-') { writeln!( &mut std::io::stderr(), "leading hyphen in file name component '{}'", @@ -236,11 +236,6 @@ fn check_searchable(path: &str) -> bool { } } -// check for a hyphen at the beginning of a path segment -fn no_leading_hyphen(path_segment: &str) -> bool { - !path_segment.starts_with('-') -} - // check whether a path segment contains only valid (read: portable) characters fn check_portable_chars(path_segment: &str) -> bool { const VALID_CHARS: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-";