mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-02 05:57: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> {
|
fn remove_dir(path: &Path, ignore: bool, verbose: bool) -> Result<(), i32> {
|
||||||
let mut read_dir = match fs::read_dir(path) {
|
let mut read_dir = fs::read_dir(path).map_err(|e| {
|
||||||
Ok(m) => m,
|
if e.raw_os_error() == Some(ENOTDIR) {
|
||||||
Err(e) if e.raw_os_error() == Some(ENOTDIR) => {
|
|
||||||
show_error!("failed to remove '{}': Not a directory", path.display());
|
show_error!("failed to remove '{}': Not a directory", path.display());
|
||||||
return Err(1);
|
} else {
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
show_error!("reading directory '{}': {}", path.display(), e);
|
show_error!("reading directory '{}': {}", path.display(), e);
|
||||||
return Err(1);
|
|
||||||
}
|
}
|
||||||
};
|
1
|
||||||
|
})?;
|
||||||
|
|
||||||
let mut r = Ok(());
|
let mut r = Ok(());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue