replace hard coded error id with ErrorKind::DirectoryNotEmpty

Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
onur-ozkan 2024-11-30 12:40:43 +03:00
parent 76f3ff6059
commit fd9019852e

View file

@ -203,10 +203,8 @@ fn rm_rf(path: &Path) {
do_op(path, "remove dir", |p| match fs::remove_dir(p) {
// Check for dir not empty on Windows
// FIXME: Once `ErrorKind::DirectoryNotEmpty` is stabilized,
// match on `e.kind()` instead.
#[cfg(windows)]
Err(e) if e.raw_os_error() == Some(145) => Ok(()),
Err(e) if e.kind() == ErrorKind::DirectoryNotEmpty => Ok(()),
r => r,
});
}