Skip to content

Commit e55e0b6

Browse files
committed
Auto merge of #33958 - kennytm:patch-1, r=GuillaumeGomez
Use Path::is_dir() in fs::read_dir()'s example. Basically reverts #25508. The `is_dir()` function has been stable since 1.5.0.
2 parents 5da602b + 048f372 commit e55e0b6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: src/libstd/fs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1338,10 +1338,10 @@ pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
13381338
///
13391339
/// // one possible implementation of walking a directory only visiting files
13401340
/// fn visit_dirs(dir: &Path, cb: &Fn(&DirEntry)) -> io::Result<()> {
1341-
/// if try!(fs::metadata(dir)).is_dir() {
1341+
/// if dir.is_dir() {
13421342
/// for entry in try!(fs::read_dir(dir)) {
13431343
/// let entry = try!(entry);
1344-
/// if try!(fs::metadata(entry.path())).is_dir() {
1344+
/// if try!(entry.file_type()).is_dir() {
13451345
/// try!(visit_dirs(&entry.path(), cb));
13461346
/// } else {
13471347
/// cb(&entry);

0 commit comments

Comments
 (0)