Skip to content

Commit 42e163b

Browse files
authored
Rollup merge of #75287 - pickfire:patch-10, r=jonas-schievink
Show Path extension example change multi extension
2 parents 28ab318 + 9532b83 commit 42e163b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/std/src/path.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2253,6 +2253,8 @@ impl Path {
22532253
///
22542254
/// let path = Path::new("foo.tar.gz");
22552255
/// assert_eq!(path.with_extension(""), PathBuf::from("foo.tar"));
2256+
/// assert_eq!(path.with_extension("xz"), PathBuf::from("foo.tar.xz"));
2257+
/// assert_eq!(path.with_extension("").with_extension("txt"), PathBuf::from("foo.txt"));
22562258
/// ```
22572259
#[stable(feature = "rust1", since = "1.0.0")]
22582260
pub fn with_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf {

0 commit comments

Comments
 (0)