Skip to content

Add documentation to point to File::open or OpenOptions::open instead of is_file to check read/write possibility #73243

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

Merged
merged 5 commits into from
Jun 28, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added the note to Metadata too
  • Loading branch information
poliorcetics committed Jun 11, 2020
commit ec63f9d99b4faec04db0f924c24be9529f4febed
6 changes: 6 additions & 0 deletions src/libstd/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,12 @@ impl Metadata {
/// [`is_dir`], and will be false for symlink metadata
/// obtained from [`symlink_metadata`].
///
/// This property means it is often more useful to use `!file_type.is_dir()`
/// than `file_type.is_file()` when your goal is to read bytes from a
/// source: the former includes symlink and pipes when the latter does not,
/// meaning you will break workflows like `diff <( prog_a ) <( prog_b )` on
/// a Unix-like system for example.
///
/// [`is_dir`]: struct.Metadata.html#method.is_dir
/// [`symlink_metadata`]: fn.symlink_metadata.html
///
Expand Down