about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexis Bourget <alexis.bourget@gmail.com>2020-06-11 18:17:00 +0200
committerAlexis Bourget <alexis.bourget@gmail.com>2020-06-11 18:17:00 +0200
commitc1243dbcd96f43d013e38f01efe91eb35b81fa18 (patch)
treeac6522aac418e3a9ac376a3978eca0813070bb09
parentec63f9d99b4faec04db0f924c24be9529f4febed (diff)
downloadrust-c1243dbcd96f43d013e38f01efe91eb35b81fa18.tar.gz
rust-c1243dbcd96f43d013e38f01efe91eb35b81fa18.zip
Make a note about is_dir vs is_file in Path too
-rw-r--r--src/libstd/path.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index 8ff7508ba64..35f6b5838a9 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -2503,11 +2503,15 @@ impl Path {
     /// # See Also
     ///
     /// This is a convenience function that coerces errors to false. If you want to
-    /// check errors, call [fs::metadata] and handle its Result. Then call
-    /// [fs::Metadata::is_file] if it was Ok.
+    /// check errors, call [`fs::metadata`] and handle its Result. Then call
+    /// [`fs::Metadata::is_file`] if it was Ok.
     ///
-    /// [fs::metadata]: ../../std/fs/fn.metadata.html
-    /// [fs::Metadata::is_file]: ../../std/fs/struct.Metadata.html#method.is_file
+    /// Note that the explanation about using `!is_dir` instead of `is_file`
+    /// that is present in the [`fs::Metadata`] documentation also applies here.
+    ///
+    /// [`fs::metadata`]: ../../std/fs/fn.metadata.html
+    /// [`fs::Metadata`]: ../../std/fs/struct.Metadata.html
+    /// [`fs::Metadata::is_file`]: ../../std/fs/struct.Metadata.html#method.is_file
     #[stable(feature = "path_ext", since = "1.5.0")]
     pub fn is_file(&self) -> bool {
         fs::metadata(self).map(|m| m.is_file()).unwrap_or(false)