summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 73cd9b0..6f68c22 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -15,13 +15,11 @@ fn create_and_open_dir<P: AsRef<Path> + Copy>(
d: &Dir,
path: P,
) -> std::io::Result<Dir> {
- match d.create_dir(path) {
- Ok(()) => Ok(()),
- Err(e) => match e.kind() {
- ErrorKind::AlreadyExists => Ok(()),
- _ => Err(e),
- },
- }?;
+ if let Err(e) = d.create_dir(path) {
+ if e.kind() != ErrorKind::AlreadyExists {
+ return Err(e);
+ }
+ }
d.open_dir(path)
}