Skip to content

Commit

Permalink
one more Path::with_extension example, to demonstrate behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
tshepang authored and dtolnay committed Jul 22, 2020
1 parent 05630b0 commit 83094ea
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libstd/path.rs
Expand Up @@ -2244,6 +2244,9 @@ impl Path {
///
/// let path = Path::new("foo.rs");
/// assert_eq!(path.with_extension("txt"), PathBuf::from("foo.txt"));
///
/// let path = Path::new("foo.tar.gz");
/// assert_eq!(path.with_extension(""), PathBuf::from("foo.tar"));
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn with_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf {
Expand Down

0 comments on commit 83094ea

Please sign in to comment.