From 913996b8ee8cbbab1651ad7702b23ad837b58c6d Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Wed, 8 Dec 2021 17:12:59 +0000 Subject: [PATCH 1/2] Remove the match on `ErrorKind::Other` It's a) superfluous and b) doesn't work any more. --- src/bootstrap/clean.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/bootstrap/clean.rs b/src/bootstrap/clean.rs index 3216c1af26730..7b8ce12bb4f25 100644 --- a/src/bootstrap/clean.rs +++ b/src/bootstrap/clean.rs @@ -76,9 +76,7 @@ fn rm_rf(path: &Path) { fs::remove_dir(p).or_else(|e| { // Check for dir not empty on Windows #[cfg(windows)] - if matches!(e.kind(), std::io::ErrorKind::Other) - && e.raw_os_error() == Some(145) - { + if e.raw_os_error() == Some(145) { return Ok(()); } From caed83d400b70ac5cd1d246c8cfdf1f9a5f888fe Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Thu, 9 Dec 2021 14:39:30 +0000 Subject: [PATCH 2/2] Add reminder to match the error kind once ` DirectoryNotEmpty` is stabilized --- src/bootstrap/clean.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bootstrap/clean.rs b/src/bootstrap/clean.rs index 7b8ce12bb4f25..3b73dc1c7df74 100644 --- a/src/bootstrap/clean.rs +++ b/src/bootstrap/clean.rs @@ -75,6 +75,8 @@ fn rm_rf(path: &Path) { do_op(path, "remove dir", |p| { fs::remove_dir(p).or_else(|e| { // Check for dir not empty on Windows + // FIXME: Once `ErrorKind::DirectoryNotEmpty` is stabilized, + // match on `e.kind()` instead. #[cfg(windows)] if e.raw_os_error() == Some(145) { return Ok(());