Skip to content

Commit 048f372

Browse files
committed
Use Path::is_dir() in fs::read_dir()'s example.
Basically reverts rust-lang#25508. The `is_dir()` function has been stable since 1.5.0.
1 parent bf9c60c commit 048f372

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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)