1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-11-08 09:09:17 +01:00

Avoid an unneeded syscall

This commit is contained in:
mo8it 2024-04-18 01:49:32 +02:00
parent 634e17a5ab
commit d64836f317

@ -47,14 +47,12 @@ impl EmbeddedFlatDir {
let path = Path::new(self.path); let path = Path::new(self.path);
if let Err(e) = create_dir(path) { if let Err(e) = create_dir(path) {
if !path.is_dir() { if e.kind() != io::ErrorKind::AlreadyExists {
return Err(e); return Err(e);
} }
} }
self.readme.write_to_disk(WriteStrategy::Overwrite)?; self.readme.write_to_disk(WriteStrategy::Overwrite)
Ok(())
} }
} }