diff options
| author | kennytm <kennytm@gmail.com> | 2016-05-30 17:12:01 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2016-05-30 17:12:01 +0800 |
| commit | 048f37254c1bb029f23ffee5658987ba5126528f (patch) | |
| tree | 7fee4cf7b6aedcf376b41dd0caaeb66e399660e0 /src/libstd | |
| parent | bf9c60c9a6d27762594c1c5c067194f4c9109f67 (diff) | |
| download | rust-048f37254c1bb029f23ffee5658987ba5126528f.tar.gz rust-048f37254c1bb029f23ffee5658987ba5126528f.zip | |
Use Path::is_dir() in fs::read_dir()'s example.
Basically reverts #25508. The `is_dir()` function has been stable since 1.5.0.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/fs.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 125170bd47b..734f774043d 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -1338,10 +1338,10 @@ pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> { /// /// // one possible implementation of walking a directory only visiting files /// fn visit_dirs(dir: &Path, cb: &Fn(&DirEntry)) -> io::Result<()> { -/// if try!(fs::metadata(dir)).is_dir() { +/// if dir.is_dir() { /// for entry in try!(fs::read_dir(dir)) { /// let entry = try!(entry); -/// if try!(fs::metadata(entry.path())).is_dir() { +/// if try!(entry.file_type()).is_dir() { /// try!(visit_dirs(&entry.path(), cb)); /// } else { /// cb(&entry); |
