From 61519b8cf1c768fd3683f38a8fcfa96dc0138cdb Mon Sep 17 00:00:00 2001 From: Ariel Davis Date: Sun, 9 Oct 2022 21:44:44 -0700 Subject: [PATCH 1/2] Add basename and dirname aliases --- library/std/src/fs.rs | 1 + library/std/src/path.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index c6c78dc3939e7..190608e43b92b 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -1670,6 +1670,7 @@ impl DirEntry { /// } /// ``` #[must_use] + #[doc(alias = "basename")] #[stable(feature = "dir_entry_ext", since = "1.1.0")] pub fn file_name(&self) -> OsString { self.0.file_name() diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 4f9dff1ef0353..9d63281627d66 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -2158,6 +2158,7 @@ impl Path { /// assert_eq!(grand_parent.parent(), None); /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[doc(alias = "dirname")] #[must_use] pub fn parent(&self) -> Option<&Path> { let mut comps = self.components(); @@ -2225,6 +2226,7 @@ impl Path { /// assert_eq!(None, Path::new("/").file_name()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[doc(alias = "basename")] #[must_use] pub fn file_name(&self) -> Option<&OsStr> { self.components().next_back().and_then(|p| match p { From d1762d7a96adbeb4702bcb4486ebf47555bfd01b Mon Sep 17 00:00:00 2001 From: Ariel Davis Date: Mon, 10 Oct 2022 17:05:59 -0700 Subject: [PATCH 2/2] Do not alias for fs --- library/std/src/fs.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 190608e43b92b..c6c78dc3939e7 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -1670,7 +1670,6 @@ impl DirEntry { /// } /// ``` #[must_use] - #[doc(alias = "basename")] #[stable(feature = "dir_entry_ext", since = "1.1.0")] pub fn file_name(&self) -> OsString { self.0.file_name()