Skip to content

Commit cbc6914

Browse files
authored
Rollup merge of #75262 - pickfire:patch-6, r=jyn514
Show multi extension example for Path in doctests
2 parents c85075d + 06cf40f commit cbc6914

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

library/std/src/path.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,9 +2140,8 @@ impl Path {
21402140
/// ```
21412141
/// use std::path::Path;
21422142
///
2143-
/// let path = Path::new("foo.rs");
2144-
///
2145-
/// assert_eq!("foo", path.file_stem().unwrap());
2143+
/// assert_eq!("foo", Path::new("foo.rs").file_stem().unwrap());
2144+
/// assert_eq!("foo.tar", Path::new("foo.tar.gz").file_stem().unwrap());
21462145
/// ```
21472146
#[stable(feature = "rust1", since = "1.0.0")]
21482147
pub fn file_stem(&self) -> Option<&OsStr> {
@@ -2166,9 +2165,8 @@ impl Path {
21662165
/// ```
21672166
/// use std::path::Path;
21682167
///
2169-
/// let path = Path::new("foo.rs");
2170-
///
2171-
/// assert_eq!("rs", path.extension().unwrap());
2168+
/// assert_eq!("rs", Path::new("foo.rs").extension().unwrap());
2169+
/// assert_eq!("gz", Path::new("foo.tar.gz").extension().unwrap());
21722170
/// ```
21732171
#[stable(feature = "rust1", since = "1.0.0")]
21742172
pub fn extension(&self) -> Option<&OsStr> {

0 commit comments

Comments
 (0)