diff options
| author | bors <bors@rust-lang.org> | 2020-07-23 08:56:45 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-07-23 08:56:45 +0000 |
| commit | 2bbfa02b1b15974d5772b520aa027bf79f8c248e (patch) | |
| tree | e7e74cc74874cf154f4b5c5ea97cf04c132c982d /src/libstd/path.rs | |
| parent | fcac11993ca055bbdc7683a2f6ed7b88a838fb0f (diff) | |
| parent | 8f02f2c1abd6c3fbd3053da5bb6759a4698a949e (diff) | |
| download | rust-2bbfa02b1b15974d5772b520aa027bf79f8c248e.tar.gz rust-2bbfa02b1b15974d5772b520aa027bf79f8c248e.zip | |
Auto merge of #74667 - Manishearth:rollup-s6k59sw, r=Manishearth
Rollup of 8 pull requests Successful merges: - #74141 (libstd/libcore: fix various typos) - #74490 (add a Backtrace::disabled function) - #74548 (one more Path::with_extension example, to demonstrate behavior) - #74587 (Prefer constant over function) - #74606 (Remove Linux workarounds for missing CLOEXEC support) - #74637 (Make str point to primitive page) - #74654 (require type defaults to be after const generic parameters) - #74659 (Improve codegen for unchecked float casts on wasm) Failed merges: r? @ghost
Diffstat (limited to 'src/libstd/path.rs')
| -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 { |
