diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-08-09 06:41:30 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-09 06:41:30 +0900 |
| commit | 42e163bf40b4fb1c129e94b2f508249d42abefc6 (patch) | |
| tree | 219e015e38690ebe7fda03dcef27ae77a1bc333a | |
| parent | 28ab318f57dc3e56b4840173aab300f4143e4b12 (diff) | |
| parent | 9532b83912e4d74deee587a303359d56e7bc5602 (diff) | |
| download | rust-42e163bf40b4fb1c129e94b2f508249d42abefc6.tar.gz rust-42e163bf40b4fb1c129e94b2f508249d42abefc6.zip | |
Rollup merge of #75287 - pickfire:patch-10, r=jonas-schievink
Show Path extension example change multi extension
| -rw-r--r-- | library/std/src/path.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 408dbd09d9b..79944d82fea 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -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 { |
