Skip to content

Commit f55adf3

Browse files
committed
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 - rust-lang/rust#85746 - rust-lang/rust#86442
1 parent c148b77 commit f55adf3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/interactive/app/handlers.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -426,13 +426,15 @@ fn delete_directory_recursively(path: PathBuf) -> Result<(), usize> {
426426
}
427427
}
428428
}
429-
Err(ref e) if e.kind() == io::ErrorKind::Other => {
430-
// assume file, save IOps
431-
num_errors += into_error_count(fs::remove_file(path));
432-
continue;
433-
}
429+
// Err(ref e) if e.kind() == io::ErrorKind::NotADirectory => {
430+
// // assume file, save IOps
431+
// num_errors += into_error_count(fs::remove_file(path));
432+
// continue;
433+
// }
434434
Err(_) => {
435-
num_errors += 1;
435+
// TODO: Reintroduce commented code once the `io_error_more` feature is stable
436+
// num_errors += 1;
437+
num_errors += into_error_count(fs::remove_file(path));
436438
continue;
437439
}
438440
};

0 commit comments

Comments
 (0)