about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexis Bourget <alexis.bourget@gmail.com>2020-06-11 17:44:33 +0200
committerAlexis Bourget <alexis.bourget@gmail.com>2020-06-11 17:44:33 +0200
commit93cbad6ed5f6a40bdd1e8cee6a9b1a39f17ab166 (patch)
treea77d304bb397210b618244f96bf18b2c0b62ed91
parent50c0192c64241d723066add22c53d472e2b9cba9 (diff)
Add documentation to point to `!is_dir` instead of `is_file`
-rw-r--r--src/libstd/fs.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs
index f4c164a324e..c2bea8d9d63 100644
--- a/src/libstd/fs.rs
+++ b/src/libstd/fs.rs
@@ -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
     ///