Skip to content

Commit bcae6a3

Browse files
committed
Reorder match checks in create_dir_all
Avoid doing `is_dir` in the fast path.
1 parent c3e2eaf commit bcae6a3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libstd/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1777,8 +1777,8 @@ impl DirBuilder {
17771777
fn create_dir_all(&self, path: &Path) -> io::Result<()> {
17781778
match self.inner.mkdir(path) {
17791779
Ok(()) => return Ok(()),
1780-
Err(_) if path.is_dir() => return Ok(()),
17811780
Err(ref e) if e.kind() == io::ErrorKind::NotFound => {}
1781+
Err(_) if path.is_dir() => return Ok(()),
17821782
Err(e) => return Err(e),
17831783
}
17841784
match path.parent() {

0 commit comments

Comments
 (0)