diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-09-28 14:49:49 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-09-28 14:59:22 -0700 |
| commit | d9a06be2249a539b17f629ea310c4a4c01a57197 (patch) | |
| tree | a4e8b8a8f39b20202dda6152ad268480e6c8e746 /src/libcore | |
| parent | 70ae3e7bf212b0db5949e113858bae1da0e6ae29 (diff) | |
| download | rust-d9a06be2249a539b17f629ea310c4a4c01a57197.tar.gz rust-d9a06be2249a539b17f629ea310c4a4c01a57197.zip | |
Fix patterns in tuple
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/core.rc | 3 | ||||
| -rw-r--r-- | src/libcore/tuple.rs | 23 |
2 files changed, 10 insertions, 16 deletions
diff --git a/src/libcore/core.rc b/src/libcore/core.rc index e2c43bf8121..4cc6ff8a259 100644 --- a/src/libcore/core.rc +++ b/src/libcore/core.rc @@ -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)]; diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs index 50f55383167..43df1bc4bbc 100644 --- a/src/libcore/tuple.rs +++ b/src/libcore/tuple.rs @@ -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) } } } |
