about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-07-23 00:42:10 -0700
committerGitHub <noreply@github.com>2020-07-23 00:42:10 -0700
commit5629223782074cc38597775e47e947081253ac26 (patch)
tree5ad283f628444bda4e42387bf68b7dccb29e7130 /src/libstd
parentf98c77c8b6593cc2da36ddb33df488ed3380f2c6 (diff)
parent83094ea11a4c1dca34fd5602c8c56e8829bf51ee (diff)
Rollup merge of #74548 - tshepang:one-more-example, r=dtolnay
one more Path::with_extension example, to demonstrate behavior
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/path.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index f14a9ff72f6..392c815ef28 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -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 {