1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-01 05:27:45 +00:00

rm: replace "if" with "match" in prompt_file()

This commit is contained in:
Daniel Hofstetter 2023-08-10 15:38:59 +02:00
parent bdd25c37cf
commit 113972aa44

View file

@ -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