@@ -2739,30 +2739,30 @@ impl Path {
2739
2739
/// # Examples
2740
2740
///
2741
2741
/// ```
2742
- /// use std::path::{ Path, PathBuf} ;
2742
+ /// use std::path::Path;
2743
2743
///
2744
2744
/// let path = Path::new("foo.rs");
2745
- /// assert_eq!(path.with_extension("txt"), PathBuf::from ("foo.txt"));
2746
- /// assert_eq!(path.with_extension(""), PathBuf::from ("foo"));
2745
+ /// assert_eq!(path.with_extension("txt"), Path::new ("foo.txt"));
2746
+ /// assert_eq!(path.with_extension(""), Path::new ("foo"));
2747
2747
/// ```
2748
2748
///
2749
2749
/// Handling multiple extensions:
2750
2750
///
2751
2751
/// ```
2752
- /// use std::path::{ Path, PathBuf} ;
2752
+ /// use std::path::Path;
2753
2753
///
2754
2754
/// let path = Path::new("foo.tar.gz");
2755
- /// assert_eq!(path.with_extension("xz"), PathBuf::from ("foo.tar.xz"));
2756
- /// assert_eq!(path.with_extension("").with_extension("txt"), PathBuf::from ("foo.txt"));
2755
+ /// assert_eq!(path.with_extension("xz"), Path::new ("foo.tar.xz"));
2756
+ /// assert_eq!(path.with_extension("").with_extension("txt"), Path::new ("foo.txt"));
2757
2757
/// ```
2758
2758
///
2759
2759
/// Adding an extension where one did not exist:
2760
2760
///
2761
2761
/// ```
2762
- /// use std::path::{ Path, PathBuf} ;
2762
+ /// use std::path::Path;
2763
2763
///
2764
2764
/// let path = Path::new("foo");
2765
- /// assert_eq!(path.with_extension("rs"), PathBuf::from ("foo.rs"));
2765
+ /// assert_eq!(path.with_extension("rs"), Path::new ("foo.rs"));
2766
2766
/// ```
2767
2767
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2768
2768
pub fn with_extension < S : AsRef < OsStr > > ( & self , extension : S ) -> PathBuf {
0 commit comments