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

Merge pull request #5755 from sylvestre/syntax

rm: improve the code a tiny bit
This commit is contained in:
Daniel Hofstetter 2023-12-31 13:35:25 +01:00 committed by GitHub
commit ed111320dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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)