Skip to content

Commit

Permalink
Rollup merge of #74548 - tshepang:one-more-example, r=dtolnay
Browse files Browse the repository at this point in the history
one more Path::with_extension example, to demonstrate behavior
  • Loading branch information
Manishearth committed Jul 23, 2020
2 parents f98c77c + 83094ea commit 5629223
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libstd/path.rs
Original file line number Diff line number Diff line change
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 5629223

Please sign in to comment.