about summary refs log tree commit diff
path: root/src/libcore/path.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcore/path.rs')
-rw-r--r--src/libcore/path.rs20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/libcore/path.rs b/src/libcore/path.rs
index 0fd30501a4c..cdd66364c11 100644
--- a/src/libcore/path.rs
+++ b/src/libcore/path.rs
@@ -20,6 +20,7 @@ Cross-platform file path handling
 
 use cmp::Eq;
 
+#[deriving_eq]
 pub struct WindowsPath {
     host: Option<~str>,
     device: Option<~str>,
@@ -31,6 +32,7 @@ pub pure fn WindowsPath(s: &str) -> WindowsPath {
     from_str(s)
 }
 
+#[deriving_eq]
 pub struct PosixPath {
     is_absolute: bool,
     components: ~[~str],
@@ -356,24 +358,6 @@ impl PosixPath : ToStr {
     }
 }
 
-impl PosixPath : Eq {
-    pure fn eq(&self, other: &PosixPath) -> bool {
-        return (*self).is_absolute == (*other).is_absolute &&
-            (*self).components == (*other).components;
-    }
-    pure fn ne(&self, other: &PosixPath) -> bool { !(*self).eq(other) }
-}
-
-impl WindowsPath : Eq {
-    pure fn eq(&self, other: &WindowsPath) -> bool {
-        return (*self).host == (*other).host &&
-            (*self).device == (*other).device &&
-            (*self).is_absolute == (*other).is_absolute &&
-            (*self).components == (*other).components;
-    }
-    pure fn ne(&self, other: &WindowsPath) -> bool { !(*self).eq(other) }
-}
-
 // FIXME (#3227): when default methods in traits are working, de-duplicate
 // PosixPath and WindowsPath, most of their methods are common.
 impl PosixPath : GenericPath {