Skip to content

Commit ece19f0

Browse files
committed
Nicer checking for not found dir
1 parent baf28c8 commit ece19f0

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
@@ -607,13 +607,10 @@ where
607607

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

0 commit comments

Comments
 (0)