diff --git a/src/libcore/either.rs b/src/libcore/either.rs index d93074e4a401..ee259263f47e 100644 --- a/src/libcore/either.rs +++ b/src/libcore/either.rs @@ -68,8 +68,8 @@ fn partition(eithers: &[Either]) let mut rights: ~[U] = ~[]; for vec::each(eithers) |elt| { match *elt { - Left(l) => lefts.push(l), - Right(r) => rights.push(r) + Left(copy l) => lefts.push(l), + Right(copy r) => rights.push(r) } } return {lefts: move lefts, rights: move rights}; @@ -79,8 +79,8 @@ pure fn flip(eith: &Either) -> Either { //! Flips between left and right of a given either match *eith { - Right(r) => Left(r), - Left(l) => Right(l) + Right(copy r) => Left(r), + Left(copy l) => Right(l) } } @@ -93,8 +93,8 @@ pure fn to_result(eith: &Either) -> Result { */ match *eith { - Right(r) => result::Ok(r), - Left(l) => result::Err(l) + Right(copy r) => result::Ok(r), + Left(copy l) => result::Err(l) } } @@ -129,16 +129,16 @@ pure fn unwrap_right(+eith: Either) -> U { impl Either : Eq { pure fn eq(other: &Either) -> bool { match self { - Left(a) => { + Left(ref a) => { match (*other) { - Left(ref b) => a.eq(b), + Left(ref b) => (*a).eq(b), Right(_) => false } } - Right(a) => { + Right(ref a) => { match (*other) { Left(_) => false, - Right(ref b) => a.eq(b) + Right(ref b) => (*a).eq(b) } } }