1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-30 12:37:49 +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) => {
if err.kind() == ErrorKind::PermissionDenied {
if let Ok(metadata) = fs::metadata(path) {
if metadata.len() == 0 {
match fs::metadata(path) {
Ok(metadata) if metadata.len() == 0 => {
prompt_yes!(
"remove write-protected regular empty file {}?",
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 {
true