Skip to content

Commit

Permalink
Show multi extension example for Path in doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
pickfire committed Aug 7, 2020
1 parent 64f99b4 commit 06cf40f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions library/std/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2140,9 +2140,8 @@ impl Path {
/// ```
/// use std::path::Path;
///
/// let path = Path::new("foo.rs");
///
/// assert_eq!("foo", path.file_stem().unwrap());
/// assert_eq!("foo", Path::new("foo.rs").file_stem().unwrap());
/// assert_eq!("foo.tar", Path::new("foo.tar.gz").file_stem().unwrap());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn file_stem(&self) -> Option<&OsStr> {
Expand All @@ -2166,9 +2165,8 @@ impl Path {
/// ```
/// use std::path::Path;
///
/// let path = Path::new("foo.rs");
///
/// assert_eq!("rs", path.extension().unwrap());
/// assert_eq!("rs", Path::new("foo.rs").extension().unwrap());
/// assert_eq!("gz", Path::new("foo.tar.gz").extension().unwrap());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn extension(&self) -> Option<&OsStr> {
Expand Down

0 comments on commit 06cf40f

Please sign in to comment.