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:
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) => {
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue