about summary refs log tree commit diff
path: root/src/libstd/path/mod.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-01-06 15:22:24 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-01-06 15:22:24 -0800
commit5c3ddcb15dc8b40fa780a38fd7494b9b5b991d09 (patch)
tree9ad6d0c242e45a785dae4b22f1e4ddd9d4f9c55a /src/libstd/path/mod.rs
parent5f27b500800fc2720c5caa4a0cd5dcc46c0b911f (diff)
parent44440e5c18a1dbcc9685866ffffe00c508929079 (diff)
downloadrust-5c3ddcb15dc8b40fa780a38fd7494b9b5b991d09.tar.gz
rust-5c3ddcb15dc8b40fa780a38fd7494b9b5b991d09.zip
rollup merge of #20481: seanmonstar/fmt-show-string
Conflicts:
	src/compiletest/runtest.rs
	src/libcore/fmt/mod.rs
	src/libfmt_macros/lib.rs
	src/libregex/parse.rs
	src/librustc/middle/cfg/construct.rs
	src/librustc/middle/dataflow.rs
	src/librustc/middle/infer/higher_ranked/mod.rs
	src/librustc/middle/ty.rs
	src/librustc_back/archive.rs
	src/librustc_borrowck/borrowck/fragments.rs
	src/librustc_borrowck/borrowck/gather_loans/mod.rs
	src/librustc_resolve/lib.rs
	src/librustc_trans/back/link.rs
	src/librustc_trans/save/mod.rs
	src/librustc_trans/trans/base.rs
	src/librustc_trans/trans/callee.rs
	src/librustc_trans/trans/common.rs
	src/librustc_trans/trans/consts.rs
	src/librustc_trans/trans/controlflow.rs
	src/librustc_trans/trans/debuginfo.rs
	src/librustc_trans/trans/expr.rs
	src/librustc_trans/trans/monomorphize.rs
	src/librustc_typeck/astconv.rs
	src/librustc_typeck/check/method/mod.rs
	src/librustc_typeck/check/mod.rs
	src/librustc_typeck/check/regionck.rs
	src/librustc_typeck/collect.rs
	src/libsyntax/ext/format.rs
	src/libsyntax/ext/source_util.rs
	src/libsyntax/ext/tt/transcribe.rs
	src/libsyntax/parse/mod.rs
	src/libsyntax/parse/token.rs
	src/test/run-pass/issue-8898.rs
Diffstat (limited to 'src/libstd/path/mod.rs')
-rw-r--r--src/libstd/path/mod.rs31
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)
     }
 }