From 912a872d3c7e12a5d9784c3bfd4cd3c911e468d9 Mon Sep 17 00:00:00 2001 From: Theo Belaire Date: Sun, 12 Apr 2015 01:10:53 -0400 Subject: [PATCH] Fixed with_extension documentation bug It was mistakenly calling it with "foo.txt" instead of "txt". I've also added an assert. --- src/libstd/path.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 4471b5afa84c8..9215c93ca1c6f 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1574,7 +1574,8 @@ impl Path { /// /// let path = Path::new("/tmp/foo.rs"); /// - /// let new_path = path.with_extension("foo.txt"); + /// let new_path = path.with_extension("txt"); + /// assert_eq!(new_path, PathBuf::from("/tmp/foo.txt")); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn with_extension>(&self, extension: S) -> PathBuf {