Reorder match checks in create_dir_all

Avoid doing `is_dir` in the fast path.
This commit is contained in:
Dawid Ciężarkiewicz 2017-03-14 22:29:00 -07:00
parent c3e2eaf4cb
commit bcae6a3734

View file

@ -1777,8 +1777,8 @@ impl DirBuilder {
fn create_dir_all(&self, path: &Path) -> io::Result<()> {
match self.inner.mkdir(path) {
Ok(()) => return Ok(()),
Err(_) if path.is_dir() => return Ok(()),
Err(ref e) if e.kind() == io::ErrorKind::NotFound => {}
Err(_) if path.is_dir() => return Ok(()),
Err(e) => return Err(e),
}
match path.parent() {