@@ -68,8 +68,8 @@ fn partition<T: Copy, U: Copy>(eithers: &[Either<T, U>])
68
68
let mut rights: ~[ U ] = ~[ ] ;
69
69
for vec:: each( eithers) |elt| {
70
70
match * elt {
71
- Left ( l) => lefts. push ( l) ,
72
- Right ( r) => rights. push ( r)
71
+ Left ( copy l) => lefts. push ( l) ,
72
+ Right ( copy r) => rights. push ( r)
73
73
}
74
74
}
75
75
return { lefts: move lefts, rights: move rights} ;
@@ -79,8 +79,8 @@ pure fn flip<T: Copy, U: Copy>(eith: &Either<T, U>) -> Either<U, T> {
79
79
//! Flips between left and right of a given either
80
80
81
81
match * eith {
82
- Right ( r) => Left ( r) ,
83
- Left ( l) => Right ( l)
82
+ Right ( copy r) => Left ( r) ,
83
+ Left ( copy l) => Right ( l)
84
84
}
85
85
}
86
86
@@ -93,8 +93,8 @@ pure fn to_result<T: Copy, U: Copy>(eith: &Either<T, U>) -> Result<U, T> {
93
93
*/
94
94
95
95
match * eith {
96
- Right ( r) => result:: Ok ( r) ,
97
- Left ( l) => result:: Err ( l)
96
+ Right ( copy r) => result:: Ok ( r) ,
97
+ Left ( copy l) => result:: Err ( l)
98
98
}
99
99
}
100
100
@@ -129,16 +129,16 @@ pure fn unwrap_right<T,U>(+eith: Either<T,U>) -> U {
129
129
impl < T : Eq , U : Eq > Either < T , U > : Eq {
130
130
pure fn eq ( other : & Either < T , U > ) -> bool {
131
131
match self {
132
- Left ( a) => {
132
+ Left ( ref a) => {
133
133
match ( * other) {
134
- Left ( ref b) => a . eq ( b) ,
134
+ Left ( ref b) => ( * a ) . eq ( b) ,
135
135
Right ( _) => false
136
136
}
137
137
}
138
- Right ( a) => {
138
+ Right ( ref a) => {
139
139
match ( * other) {
140
140
Left ( _) => false ,
141
- Right ( ref b) => a . eq ( b)
141
+ Right ( ref b) => ( * a ) . eq ( b)
142
142
}
143
143
}
144
144
}
0 commit comments