diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-12-11 15:16:36 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-12-13 16:14:28 -0800 |
| commit | d809e89c2682c3bb0ec0b58d7a8beb71060ae619 (patch) | |
| tree | 3e31eb1e518adf5f6c27dab2390b2973e95c7b6e /src/libcore/either.rs | |
| parent | 742f354ffb08d81f6977aabc78a854cced22b9d3 (diff) | |
| download | rust-d809e89c2682c3bb0ec0b58d7a8beb71060ae619.tar.gz rust-d809e89c2682c3bb0ec0b58d7a8beb71060ae619.zip | |
Replace some Eq impls with deriving_eq
Diffstat (limited to 'src/libcore/either.rs')
| -rw-r--r-- | src/libcore/either.rs | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/src/libcore/either.rs b/src/libcore/either.rs index 878fd81651a..74b29f3a5f1 100644 --- a/src/libcore/either.rs +++ b/src/libcore/either.rs @@ -18,6 +18,7 @@ use cmp::Eq; use result::Result; /// The either type +#[deriving_eq] pub enum Either<T, U> { Left(T), Right(U) @@ -141,26 +142,6 @@ pub pure fn unwrap_right<T,U>(eith: Either<T,U>) -> U { } } -impl<T:Eq,U:Eq> Either<T,U> : Eq { - pure fn eq(&self, other: &Either<T,U>) -> bool { - match (*self) { - Left(ref a) => { - match (*other) { - Left(ref b) => (*a).eq(b), - Right(_) => false - } - } - Right(ref a) => { - match (*other) { - Left(_) => false, - Right(ref b) => (*a).eq(b) - } - } - } - } - pure fn ne(&self, other: &Either<T,U>) -> bool { !(*self).eq(other) } -} - #[test] fn test_either_left() { let val = Left(10); |
