1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

rm: improve the code a tiny bit

This commit is contained in:
Sylvestre Ledru 2023-12-31 12:03:42 +01:00
parent 5fc01f718a
commit b07ea957d3

View file

@ -334,7 +334,7 @@ fn handle_dir(path: &Path, options: &Options) -> bool {
// remove_dir_all failed. maybe it is because of the permissions // remove_dir_all failed. maybe it is because of the permissions
// but if the directory is empty, remove_dir might work. // but if the directory is empty, remove_dir might work.
// So, let's try that before failing for real // So, let's try that before failing for real
if let Err(_e) = fs::remove_dir(path) { if fs::remove_dir(path).is_err() {
had_err = true; had_err = true;
if e.kind() == std::io::ErrorKind::PermissionDenied { if e.kind() == std::io::ErrorKind::PermissionDenied {
// GNU compatibility (rm/fail-eacces.sh) // GNU compatibility (rm/fail-eacces.sh)