mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-10 22:13:27 +00:00
Use Path::is_dir() in fs::read_dir()'s example.
Basically reverts #25508. The `is_dir()` function has been stable since 1.5.0.
This commit is contained in:
parent
bf9c60c9a6
commit
048f37254c
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user