Skip to content

Commit c1243db

Browse files
committed
Make a note about is_dir vs is_file in Path too
1 parent ec63f9d commit c1243db

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/libstd/path.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -2503,11 +2503,15 @@ impl Path {
25032503
/// # See Also
25042504
///
25052505
/// This is a convenience function that coerces errors to false. If you want to
2506-
/// check errors, call [fs::metadata] and handle its Result. Then call
2507-
/// [fs::Metadata::is_file] if it was Ok.
2506+
/// check errors, call [`fs::metadata`] and handle its Result. Then call
2507+
/// [`fs::Metadata::is_file`] if it was Ok.
25082508
///
2509-
/// [fs::metadata]: ../../std/fs/fn.metadata.html
2510-
/// [fs::Metadata::is_file]: ../../std/fs/struct.Metadata.html#method.is_file
2509+
/// Note that the explanation about using `!is_dir` instead of `is_file`
2510+
/// that is present in the [`fs::Metadata`] documentation also applies here.
2511+
///
2512+
/// [`fs::metadata`]: ../../std/fs/fn.metadata.html
2513+
/// [`fs::Metadata`]: ../../std/fs/struct.Metadata.html
2514+
/// [`fs::Metadata::is_file`]: ../../std/fs/struct.Metadata.html#method.is_file
25112515
#[stable(feature = "path_ext", since = "1.5.0")]
25122516
pub fn is_file(&self) -> bool {
25132517
fs::metadata(self).map(|m| m.is_file()).unwrap_or(false)

0 commit comments

Comments
 (0)