Skip to content

Commit 5629223

Browse files
authored
Rollup merge of #74548 - tshepang:one-more-example, r=dtolnay
one more Path::with_extension example, to demonstrate behavior
2 parents f98c77c + 83094ea commit 5629223

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/libstd/path.rs

+3
Original file line numberDiff line numberDiff line change
@@ -2244,6 +2244,9 @@ impl Path {
22442244
///
22452245
/// let path = Path::new("foo.rs");
22462246
/// assert_eq!(path.with_extension("txt"), PathBuf::from("foo.txt"));
2247+
///
2248+
/// let path = Path::new("foo.tar.gz");
2249+
/// assert_eq!(path.with_extension(""), PathBuf::from("foo.tar"));
22472250
/// ```
22482251
#[stable(feature = "rust1", since = "1.0.0")]
22492252
pub fn with_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf {

0 commit comments

Comments
 (0)