diff options
Diffstat (limited to 'src/libstd/path/mod.rs')
| -rw-r--r-- | src/libstd/path/mod.rs | 31 | 
1 files changed, 19 insertions, 12 deletions
| diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs index 87188c0d4a2..0448e6907e3 100644 --- a/src/libstd/path/mod.rs +++ b/src/libstd/path/mod.rs @@ -460,7 +460,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # #[cfg(unix)] fn foo() { /// let mut p = Path::new("abc/def.txt"); /// p.set_extension("csv"); - /// assert!(p == Path::new("abc/def.csv")); + /// assert_eq!(p, Path::new("abc/def.csv")); /// # } /// ``` /// @@ -509,7 +509,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { /// let mut p = Path::new("abc/def.txt"); - /// assert!(p.with_filename("foo.dat") == Path::new("abc/foo.dat")); + /// assert_eq!(p.with_filename("foo.dat"), Path::new("abc/foo.dat")); /// # } /// ``` /// @@ -534,7 +534,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { /// let mut p = Path::new("abc/def.txt"); - /// assert!(p.with_extension("csv") == Path::new("abc/def.csv")); + /// assert_eq!(p.with_extension("csv"), Path::new("abc/def.csv")); /// # } /// ``` /// @@ -558,7 +558,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { /// let p = Path::new("abc/def/ghi"); - /// assert!(p.dir_path() == Path::new("abc/def")); + /// assert_eq!(p.dir_path(), Path::new("abc/def")); /// # } /// ``` fn dir_path(&self) -> Self { @@ -576,8 +576,8 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # foo(); /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { - /// assert!(Path::new("abc/def").root_path() == None); - /// assert!(Path::new("/abc/def").root_path() == Some(Path::new("/"))); + /// assert_eq!(Path::new("abc/def").root_path(), None); + /// assert_eq!(Path::new("/abc/def").root_path(), Some(Path::new("/"))); /// # } /// ``` fn root_path(&self) -> Option<Self>; @@ -593,7 +593,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # #[cfg(unix)] fn foo() { /// let mut p = Path::new("foo/bar"); /// p.push("baz.txt"); - /// assert!(p == Path::new("foo/bar/baz.txt")); + /// assert_eq!(p, Path::new("foo/bar/baz.txt")); /// # } /// ``` /// @@ -617,7 +617,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # #[cfg(unix)] fn foo() { /// let mut p = Path::new("foo"); /// p.push_many(&["bar", "baz.txt"]); - /// assert!(p == Path::new("foo/bar/baz.txt")); + /// assert_eq!(p, Path::new("foo/bar/baz.txt")); /// # } /// ``` #[inline] @@ -646,7 +646,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # #[cfg(unix)] fn foo() { /// let mut p = Path::new("foo/bar/baz.txt"); /// p.pop(); - /// assert!(p == Path::new("foo/bar")); + /// assert_eq!(p, Path::new("foo/bar")); /// # } /// ``` fn pop(&mut self) -> bool; @@ -662,7 +662,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # #[cfg(windows)] fn foo() {} /// # #[cfg(unix)] fn foo() { /// let p = Path::new("/foo"); - /// assert!(p.join("bar.txt") == Path::new("/foo/bar.txt")); + /// assert_eq!(p.join("bar.txt"), Path::new("/foo/bar.txt")); /// # } /// ``` /// @@ -688,7 +688,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # #[cfg(unix)] fn foo() { /// let p = Path::new("foo"); /// let fbbq = Path::new("foo/bar/baz/quux.txt"); - /// assert!(p.join_many(&["bar", "baz", "quux.txt"]) == fbbq); + /// assert_eq!(p.join_many(&["bar", "baz", "quux.txt"]), fbbq); /// # } /// ``` #[inline] @@ -765,7 +765,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// let p = Path::new("foo/bar/baz/quux.txt"); /// let fb = Path::new("foo/bar"); /// let bq = Path::new("baz/quux.txt"); - /// assert!(p.path_relative_from(&fb) == Some(bq)); + /// assert_eq!(p.path_relative_from(&fb), Some(bq)); /// # } /// ``` fn path_relative_from(&self, base: &Self) -> Option<Self>; @@ -823,8 +823,15 @@ pub struct Display<'a, P:'a> { filename: bool } +//NOTE(stage0): replace with deriving(Show) after snapshot impl<'a, P: GenericPath> fmt::Show for Display<'a, P> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(self, f) + } +} + +impl<'a, P: GenericPath> fmt::String for Display<'a, P> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.as_cow().fmt(f) } } | 
