about summary refs log tree commit diff
diff options
context:
space:
mode:
authorIvan Tham <pickfire@riseup.net>2020-08-08 18:14:29 +0800
committerGitHub <noreply@github.com>2020-08-08 18:14:29 +0800
commit9532b83912e4d74deee587a303359d56e7bc5602 (patch)
tree727fb572782c424cafbd0de351d35d10c4235e39
parentd19d7e27552b8da17932384b8db53927a1f4e00e (diff)
downloadrust-9532b83912e4d74deee587a303359d56e7bc5602.tar.gz
rust-9532b83912e4d74deee587a303359d56e7bc5602.zip
Show Path extension example change multi extension
-rw-r--r--library/std/src/path.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/std/src/path.rs b/library/std/src/path.rs
index 392c815ef28..0815dfd4714 100644
--- a/library/std/src/path.rs
+++ b/library/std/src/path.rs
@@ -2247,6 +2247,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 {