diff options
| author | Tshepang Lekhonkhobe <tshepang@gmail.com> | 2020-07-20 12:25:12 +0200 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2020-07-22 16:39:45 -0700 |
| commit | 83094ea11a4c1dca34fd5602c8c56e8829bf51ee (patch) | |
| tree | 7b310def98c57a84b7193044a4c71502e067699e | |
| parent | 05630b06fdf76c25c6ccf2e9ac3567592eae6c67 (diff) | |
| download | rust-83094ea11a4c1dca34fd5602c8c56e8829bf51ee.tar.gz rust-83094ea11a4c1dca34fd5602c8c56e8829bf51ee.zip | |
one more Path::with_extension example, to demonstrate behavior
| -rw-r--r-- | src/libstd/path.rs | 3 |
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 { |
