mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-31 13:07:46 +00:00
rm: replace "if" with "match" in prompt_file()
This commit is contained in:
parent
bdd25c37cf
commit
113972aa44
1 changed files with 3 additions and 6 deletions
|
@ -494,17 +494,14 @@ fn prompt_file(path: &Path, options: &Options) -> bool {
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
if err.kind() == ErrorKind::PermissionDenied {
|
if err.kind() == ErrorKind::PermissionDenied {
|
||||||
if let Ok(metadata) = fs::metadata(path) {
|
match fs::metadata(path) {
|
||||||
if metadata.len() == 0 {
|
Ok(metadata) if metadata.len() == 0 => {
|
||||||
prompt_yes!(
|
prompt_yes!(
|
||||||
"remove write-protected regular empty file {}?",
|
"remove write-protected regular empty file {}?",
|
||||||
path.quote()
|
path.quote()
|
||||||
)
|
)
|
||||||
} else {
|
|
||||||
prompt_yes!("remove write-protected regular file {}?", path.quote())
|
|
||||||
}
|
}
|
||||||
} else {
|
_ => prompt_yes!("remove write-protected regular file {}?", path.quote()),
|
||||||
prompt_yes!("remove write-protected regular file {}?", path.quote())
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
true
|
true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue