@@ -2746,30 +2746,30 @@ impl Path {
27462746 /// # Examples
27472747 ///
27482748 /// ```
2749- /// use std::path::{ Path, PathBuf} ;
2749+ /// use std::path::Path;
27502750 ///
27512751 /// let path = Path::new("foo.rs");
2752- /// assert_eq!(path.with_extension("txt"), PathBuf::from ("foo.txt"));
2753- /// assert_eq!(path.with_extension(""), PathBuf::from ("foo"));
2752+ /// assert_eq!(path.with_extension("txt"), Path::new ("foo.txt"));
2753+ /// assert_eq!(path.with_extension(""), Path::new ("foo"));
27542754 /// ```
27552755 ///
27562756 /// Handling multiple extensions:
27572757 ///
27582758 /// ```
2759- /// use std::path::{ Path, PathBuf} ;
2759+ /// use std::path::Path;
27602760 ///
27612761 /// let path = Path::new("foo.tar.gz");
2762- /// assert_eq!(path.with_extension("xz"), PathBuf::from ("foo.tar.xz"));
2763- /// assert_eq!(path.with_extension("").with_extension("txt"), PathBuf::from ("foo.txt"));
2762+ /// assert_eq!(path.with_extension("xz"), Path::new ("foo.tar.xz"));
2763+ /// assert_eq!(path.with_extension("").with_extension("txt"), Path::new ("foo.txt"));
27642764 /// ```
27652765 ///
27662766 /// Adding an extension where one did not exist:
27672767 ///
27682768 /// ```
2769- /// use std::path::{ Path, PathBuf} ;
2769+ /// use std::path::Path;
27702770 ///
27712771 /// let path = Path::new("foo");
2772- /// assert_eq!(path.with_extension("rs"), PathBuf::from ("foo.rs"));
2772+ /// assert_eq!(path.with_extension("rs"), Path::new ("foo.rs"));
27732773 /// ```
27742774 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
27752775 pub fn with_extension < S : AsRef < OsStr > > ( & self , extension : S ) -> PathBuf {
0 commit comments