Rollup merge of #75287 - pickfire:patch-10, r=jonas-schievink

Show Path extension example change multi extension
This commit is contained in:
Yuki Okushi 2020-08-09 06:41:30 +09:00 committed by GitHub
commit 42e163bf40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2253,6 +2253,8 @@ impl Path {
///
/// let path = Path::new("foo.tar.gz");
/// assert_eq!(path.with_extension(""), PathBuf::from("foo.tar"));
/// assert_eq!(path.with_extension("xz"), PathBuf::from("foo.tar.xz"));
/// assert_eq!(path.with_extension("").with_extension("txt"), PathBuf::from("foo.txt"));
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn with_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf {