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>(&self, extension: S) -> PathBuf {