Skip to content

Commit ccde95f

Browse files
authored
Rollup merge of rust-lang#102869 - azdavis:master, r=joshtriplett
Add basename and dirname aliases Users might be used to the POSIX names of these functions. In fact, here's a [blog post][1] about this very thing. [1]: https://boinkor.net/2019/07/basename-and-dirname-in-rust/
2 parents 1b1223d + d1762d7 commit ccde95f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/std/src/path.rs

+2
Original file line numberDiff line numberDiff line change
@@ -2158,6 +2158,7 @@ impl Path {
21582158
/// assert_eq!(grand_parent.parent(), None);
21592159
/// ```
21602160
#[stable(feature = "rust1", since = "1.0.0")]
2161+
#[doc(alias = "dirname")]
21612162
#[must_use]
21622163
pub fn parent(&self) -> Option<&Path> {
21632164
let mut comps = self.components();
@@ -2225,6 +2226,7 @@ impl Path {
22252226
/// assert_eq!(None, Path::new("/").file_name());
22262227
/// ```
22272228
#[stable(feature = "rust1", since = "1.0.0")]
2229+
#[doc(alias = "basename")]
22282230
#[must_use]
22292231
pub fn file_name(&self) -> Option<&OsStr> {
22302232
self.components().next_back().and_then(|p| match p {

0 commit comments

Comments
 (0)