Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Path::is_dir() in fs::read_dir()'s example. #33958

Merged
merged 1 commit into from May 30, 2016
Merged

Conversation

kennytm
Copy link
Member

@kennytm kennytm commented May 30, 2016

Basically reverts #25508. The is_dir() function has been stable since 1.5.0.

Basically reverts rust-lang#25508. The `is_dir()` function has been stable since 1.5.0.
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@GuillaumeGomez
Copy link
Member

It's now useless to import use std::fs::{self if I'm not mistaken.

Once fixed, it can be merged.

@kennytm
Copy link
Member Author

kennytm commented May 30, 2016

@GuillaumeGomez It is still needed since there is a fs::read_dir call on line 1342.

@GuillaumeGomez
Copy link
Member

Oh right, sorry didn't see that one. Then it's all good. Thanks!

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented May 30, 2016

📌 Commit 048f372 has been approved by GuillaumeGomez

@bors
Copy link
Contributor

bors commented May 30, 2016

⌛ Testing commit 048f372 with merge e55e0b6...

bors added a commit that referenced this pull request May 30, 2016
Use Path::is_dir() in fs::read_dir()'s example.

Basically reverts #25508. The `is_dir()` function has been stable since 1.5.0.
Manishearth added a commit to Manishearth/rust that referenced this pull request May 30, 2016
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.
@bors
Copy link
Contributor

bors commented May 30, 2016

⛄ The build was interrupted to prioritize another pull request.

bors added a commit that referenced this pull request May 30, 2016
Rollup of 5 pull requests

- Successful merges: #33867, #33926, #33942, #33958, #33964
- Failed merges:
@bors bors merged commit 048f372 into rust-lang:master May 30, 2016
/// 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() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually changing the meaning of this example because file_type() doesn't follow symlinks, perhaps this could change to calling is_dir on the return value of path to preserve the same behavior?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arf, I misread the doc then. :-/

My bad.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexcrichton Oops sorry. Since this has been merged, do I submit another PR for this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kennytm: Yes please.

kennytm added a commit to kennytm/rust that referenced this pull request Jun 1, 2016
…st-lang#33958.

DirEntry.file_type().is_dir() will not follow symlinks, but the original
example (fs::metadata(&path).is_dir()) does. Therefore the change in
rust-lang#33958 introduced a subtle difference that now it won't enter linked
folders. To preserve the same behavior, we use Path::is_dir() instead,
which does follow symlink.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jun 2, 2016
Restore original meaning of std::fs::read_dir's example changed in rust-lang#33958

`DirEntry.file_type().is_dir()` will not follow symlinks, but the original example (`fs::metadata(&path).is_dir()`) does. Therefore the change in rust-lang#33958 introduced a subtle difference that now it won't enter linked folders. To preserve the same behavior, we use `Path::is_dir()` instead, which does follow symlink.

(See discussion in the previous PR for detail.)
@kennytm kennytm deleted the patch-1 branch June 8, 2016 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants