Skip to content

Commit 93b01a6

Browse files
authored
Merge pull request #2210 from lzutao/errnotfound
Nicer checking for not found dir
2 parents 0ac2dd7 + ece19f0 commit 93b01a6

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/utils/utils.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -608,13 +608,10 @@ where
608608

609609
pub fn delete_dir_contents(dir_path: &Path) {
610610
match remove_dir_all::remove_dir_all(dir_path) {
611-
Ok(_) => {}
612-
Err(e) => match e.kind() {
613-
io::ErrorKind::NotFound => {
614-
// Nothing to do here
615-
}
616-
_ => panic!("Unable to clean up {}: {:?}", dir_path.display(), e),
617-
},
611+
Err(e) if e.kind() != io::ErrorKind::NotFound => {
612+
panic!("Unable to clean up {}: {:?}", dir_path.display(), e);
613+
}
614+
_ => {}
618615
}
619616
}
620617

0 commit comments

Comments
 (0)