Skip to content

Commit

Permalink
Add documentation to point to !is_dir instead of is_file
Browse files Browse the repository at this point in the history
  • Loading branch information
poliorcetics committed Jun 11, 2020
1 parent 50c0192 commit 93cbad6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/libstd/fs.rs
Expand Up @@ -1307,6 +1307,12 @@ impl FileType {
/// [`is_dir`] and [`is_symlink`]; only zero or one of these
/// tests may pass.
///
/// 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.FileType.html#method.is_dir
/// [`is_symlink`]: struct.FileType.html#method.is_symlink
///
Expand Down

0 comments on commit 93cbad6

Please sign in to comment.