mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-01 21:47:46 +00:00
rmdir: clean up returning Err
This commit is contained in:
parent
7cc4bf6e36
commit
2dd9822d57
1 changed files with 5 additions and 8 deletions
|
@ -109,17 +109,14 @@ fn remove(dirs: Vec<String>, ignore: bool, parents: bool, verbose: bool) -> Resu
|
|||
}
|
||||
|
||||
fn remove_dir(path: &Path, ignore: bool, verbose: bool) -> Result<(), i32> {
|
||||
let mut read_dir = match fs::read_dir(path) {
|
||||
Ok(m) => m,
|
||||
Err(e) if e.raw_os_error() == Some(ENOTDIR) => {
|
||||
let mut read_dir = fs::read_dir(path).map_err(|e| {
|
||||
if e.raw_os_error() == Some(ENOTDIR) {
|
||||
show_error!("failed to remove '{}': Not a directory", path.display());
|
||||
return Err(1);
|
||||
}
|
||||
Err(e) => {
|
||||
} else {
|
||||
show_error!("reading directory '{}': {}", path.display(), e);
|
||||
return Err(1);
|
||||
}
|
||||
};
|
||||
1
|
||||
})?;
|
||||
|
||||
let mut r = Ok(());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue