Fix patterns in tuple
This commit is contained in:
parent
70ae3e7bf2
commit
d9a06be224
@ -39,6 +39,9 @@ Implicitly, all crates behave as if they included the following prologue:
|
||||
#[legacy_modes];
|
||||
#[legacy_exports];
|
||||
|
||||
#[warn(deprecated_mode)];
|
||||
#[warn(deprecated_pattern)];
|
||||
|
||||
#[warn(vecs_implicitly_copyable)];
|
||||
#[deny(non_camel_case_types)];
|
||||
|
||||
|
@ -78,14 +78,10 @@ impl<A: Copy, B: Copy> (~[A], ~[B]): ExtendedTupleOps<A,B> {
|
||||
|
||||
impl<A: Eq, B: Eq> (A, B) : Eq {
|
||||
pure fn eq(other: &(A, B)) -> bool {
|
||||
// XXX: This would be a lot less wordy with ref bindings, but I don't
|
||||
// trust that they work yet.
|
||||
match self {
|
||||
(self_a, self_b) => {
|
||||
match (*other) {
|
||||
(ref other_a, ref other_b) => {
|
||||
self_a.eq(other_a) && self_b.eq(other_b)
|
||||
}
|
||||
(ref self_a, ref self_b) => match other {
|
||||
&(ref other_a, ref other_b) => {
|
||||
(*self_a).eq(other_a) && (*self_b).eq(other_b)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -115,16 +111,11 @@ impl<A: Ord, B: Ord> (A, B) : Ord {
|
||||
|
||||
impl<A: Eq, B: Eq, C: Eq> (A, B, C) : Eq {
|
||||
pure fn eq(other: &(A, B, C)) -> bool {
|
||||
// XXX: This would be a lot less wordy with ref bindings, but I don't
|
||||
// trust that they work yet.
|
||||
match self {
|
||||
(self_a, self_b, self_c) => {
|
||||
match (*other) {
|
||||
(ref other_a, ref other_b, ref other_c) => {
|
||||
self_a.eq(other_a) &&
|
||||
self_b.eq(other_b) &&
|
||||
self_c.eq(other_c)
|
||||
}
|
||||
(ref self_a, ref self_b, ref self_c) => match other {
|
||||
&(ref other_a, ref other_b, ref other_c) => {
|
||||
(*self_a).eq(other_a) && (*self_b).eq(other_b)
|
||||
&& (*self_c).eq(other_c)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user