diff options
| author | Max Wase <max.vvase@gmail.com> | 2021-05-27 18:02:21 +0300 |
|---|---|---|
| committer | Max Wase <max.vvase@gmail.com> | 2021-05-27 18:02:21 +0300 |
| commit | a0958df56f9f6714aa31c9d8812434a0f2f8f992 (patch) | |
| tree | b0665c99e608d618c2580cd4081ff5141a93b8cb | |
| parent | 2d88c52ab7173f82db4e309661fb06ebdf55b3a6 (diff) | |
| download | rust-a0958df56f9f6714aa31c9d8812434a0f2f8f992.tar.gz rust-a0958df56f9f6714aa31c9d8812434a0f2f8f992.zip | |
Review fixes + doc-features
| -rw-r--r-- | library/std/src/fs.rs | 5 | ||||
| -rw-r--r-- | library/std/src/path.rs | 9 |
2 files changed, 8 insertions, 6 deletions
diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 8e89f5a1891..521693d7f2c 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -1007,17 +1007,18 @@ impl Metadata { self.file_type().is_file() } - /// Returns `true` if this metadata is for a symbolic link file. + /// Returns `true` if this metadata is for a symbolic link. /// /// # Examples /// /// ```no_run + /// #![feature(is_symlink)] /// use std::fs; /// use std::path::Path; /// use std::os::unix::fs::symlink; /// /// fn main() -> std::io::Result<()> { - /// let link_path = Path::new("/link"); + /// let link_path = Path::new("link"); /// symlink("/origin_does_not_exists/", link_path)?; /// /// let metadata = fs::symlink_metadata(link_path)?; diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 719f28dd604..9afeb173f20 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -2568,11 +2568,11 @@ impl Path { fs::metadata(self).map(|m| m.is_dir()).unwrap_or(false) } - /// Returns true if the path exists on disk and is pointing at a symbolic link file. + /// Returns true if the path exists on disk and is pointing at a symbolic link. /// This method can alse be used to check whether symlink exists. /// /// This function will not traverse symbolic links. - /// In case of broken symbolic links this will also return true. + /// In case of a broken symbolic link this will also return true. /// /// If you cannot access the directory containing the file, e.g., because of a /// permission error, this will return false. @@ -2580,11 +2580,12 @@ impl Path { /// # Examples /// /// ```no_run + /// #![feature(is_symlink)] /// use std::path::Path; /// use std::os::unix::fs::symlink; /// - /// let link_path = Path::new("/link"); - /// symlink("/origin_does_not_exists/", link_path)?; + /// let link_path = Path::new("link"); + /// symlink("/origin_does_not_exists/", link_path).unwrap(); /// assert_eq!(link_path.is_symlink(), true); /// assert_eq!(link_path.exists(), false); /// ``` |
