Skip to content

Commit

Permalink
Stabilize is_symlink() for Metadata and Path
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwase committed Oct 8, 2021
1 parent e0aaffd commit 55663a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions library/std/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,6 @@ impl Metadata {
///
#[cfg_attr(unix, doc = "```no_run")]
#[cfg_attr(not(unix), doc = "```ignore")]
/// #![feature(is_symlink)]
/// use std::fs;
/// use std::path::Path;
/// use std::os::unix::fs::symlink;
Expand All @@ -1036,7 +1035,7 @@ impl Metadata {
/// Ok(())
/// }
/// ```
#[unstable(feature = "is_symlink", issue = "85748")]
#[stable(feature = "is_symlink", since = "1.57.0")]
pub fn is_symlink(&self) -> bool {
self.file_type().is_symlink()
}
Expand Down
5 changes: 2 additions & 3 deletions library/std/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2723,7 +2723,7 @@ 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.
/// Returns `true` if the path exists on disk and is pointing at a symbolic link.
///
/// This function will not traverse symbolic links.
/// In case of a broken symbolic link this will also return true.
Expand All @@ -2735,7 +2735,6 @@ impl Path {
///
#[cfg_attr(unix, doc = "```no_run")]
#[cfg_attr(not(unix), doc = "```ignore")]
/// #![feature(is_symlink)]
/// use std::path::Path;
/// use std::os::unix::fs::symlink;
///
Expand All @@ -2744,7 +2743,7 @@ impl Path {
/// assert_eq!(link_path.is_symlink(), true);
/// assert_eq!(link_path.exists(), false);
/// ```
#[unstable(feature = "is_symlink", issue = "85748")]
#[stable(feature = "is_symlink", since = "1.57.0")]
pub fn is_symlink(&self) -> bool {
fs::symlink_metadata(self).map(|m| m.is_symlink()).unwrap_or(false)
}
Expand Down

0 comments on commit 55663a7

Please sign in to comment.