mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-09-16 11:46:17 +00:00
refactor/pathchk ~ fix cargo clippy
complaint (clippy::needless_borrow)
This commit is contained in:
parent
b3dd80d39c
commit
02f35c8965
1 changed files with 6 additions and 6 deletions
|
@ -118,10 +118,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||||
// check a path, given as a slice of it's components and an operating mode
|
// check a path, given as a slice of it's components and an operating mode
|
||||||
fn check_path(mode: &Mode, path: &[String]) -> bool {
|
fn check_path(mode: &Mode, path: &[String]) -> bool {
|
||||||
match *mode {
|
match *mode {
|
||||||
Mode::Basic => check_basic(&path),
|
Mode::Basic => check_basic(path),
|
||||||
Mode::Extra => check_default(&path) && check_extra(&path),
|
Mode::Extra => check_default(path) && check_extra(path),
|
||||||
Mode::Both => check_basic(&path) && check_extra(&path),
|
Mode::Both => check_basic(path) && check_extra(path),
|
||||||
_ => check_default(&path),
|
_ => check_default(path),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ fn check_basic(path: &[String]) -> bool {
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if !check_portable_chars(&p) {
|
if !check_portable_chars(p) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ fn check_basic(path: &[String]) -> bool {
|
||||||
fn check_extra(path: &[String]) -> bool {
|
fn check_extra(path: &[String]) -> bool {
|
||||||
// components: leading hyphens
|
// components: leading hyphens
|
||||||
for p in path {
|
for p in path {
|
||||||
if !no_leading_hyphen(&p) {
|
if !no_leading_hyphen(p) {
|
||||||
writeln!(
|
writeln!(
|
||||||
&mut std::io::stderr(),
|
&mut std::io::stderr(),
|
||||||
"leading hyphen in file name component '{}'",
|
"leading hyphen in file name component '{}'",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue