Skip to content

Commit

Permalink
Reorder match checks in create_dir_all
Browse files Browse the repository at this point in the history
Avoid doing `is_dir` in the fast path.
  • Loading branch information
dpc committed Mar 18, 2017
1 parent c3e2eaf commit bcae6a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libstd/fs.rs
Expand Up @@ -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() {
Expand Down

0 comments on commit bcae6a3

Please sign in to comment.