diff options
-rw-r--r-- | src/lib.rs | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -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) } |