summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris-Chengbiao Zhou <bobo1239@web.de>2021-09-17 15:16:26 +0200
committerSebastian Thiel <sebastian.thiel@icloud.com>2021-09-18 09:36:14 +0800
commitf45681aa523fa6cc9d451ef46a8ce62f2ef99bf8 (patch)
tree3839d0188324fee9ce9dda221833364d0710c9d4
parentc148b779e9eb1ef109fe9276fc378c9d7a553e37 (diff)
Fix deletion process on Rust 1.55
Rust 1.55 unfortunately breaks the existing code which assumed that ErrorKind::Other will be returned by fs::read_dir() when a file is encountered. For now just always try deleting as if it's a file with the possibility to add the optimization back again once the `io_error_more` feature is stabilized. References: - https://blog.rust-lang.org/2021/09/09/Rust-1.55.0.html#stdioerrorkind-variants-updated - https://github.com/rust-lang/rust/pull/85746 - https://github.com/rust-lang/rust/issues/86442
-rw-r--r--src/interactive/app/handlers.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/interactive/app/handlers.rs b/src/interactive/app/handlers.rs
index d36e5f8..1c9c45c 100644
--- a/src/interactive/app/handlers.rs
+++ b/src/interactive/app/handlers.rs
@@ -426,13 +426,15 @@ fn delete_directory_recursively(path: PathBuf) -> Result<(), usize> {
}
}
}
- Err(ref e) if e.kind() == io::ErrorKind::Other => {
- // assume file, save IOps
- num_errors += into_error_count(fs::remove_file(path));
- continue;
- }
+ // Err(ref e) if e.kind() == io::ErrorKind::NotADirectory => {
+ // // assume file, save IOps
+ // num_errors += into_error_count(fs::remove_file(path));
+ // continue;
+ // }
Err(_) => {
- num_errors += 1;
+ // TODO: Reintroduce commented code once the `io_error_more` feature is stable
+ // num_errors += 1;
+ num_errors += into_error_count(fs::remove_file(path));
continue;
}
};