mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-11 06:24:24 +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
|
/// // one possible implementation of walking a directory only visiting files
|
||||||
/// fn visit_dirs(dir: &Path, cb: &Fn(&DirEntry)) -> io::Result<()> {
|
/// 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)) {
|
/// for entry in try!(fs::read_dir(dir)) {
|
||||||
/// let entry = try!(entry);
|
/// 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));
|
/// try!(visit_dirs(&entry.path(), cb));
|
||||||
/// } else {
|
/// } else {
|
||||||
/// cb(&entry);
|
/// cb(&entry);
|
||||||
|
Loading…
Reference in New Issue
Block a user