From 83094ea11a4c1dca34fd5602c8c56e8829bf51ee Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Mon, 20 Jul 2020 12:25:12 +0200 Subject: [PATCH] one more Path::with_extension example, to demonstrate behavior --- src/libstd/path.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libstd/path.rs b/src/libstd/path.rs index f14a9ff72f62f..392c815ef2803 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>(&self, extension: S) -> PathBuf {