about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authornham <hamann.nick@gmail.com>2014-07-27 14:41:33 -0400
committernham <hamann.nick@gmail.com>2014-07-27 14:41:33 -0400
commite7b41caba8b968450717b487087b5a2cdc10461a (patch)
tree406abadbf636981c1e9f0718f9dbcea3d61cd06b /src
parente0d10bb69ab04ab041b39c71f7537d8c63ef9669 (diff)
downloadrust-e7b41caba8b968450717b487087b5a2cdc10461a.tar.gz
rust-e7b41caba8b968450717b487087b5a2cdc10461a.zip
Implement Hash for tuples of up to arity 12. Also change the style to be consistent with core::tuple
Diffstat (limited to 'src')
-rw-r--r--src/libcollections/hash/mod.rs29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/libcollections/hash/mod.rs b/src/libcollections/hash/mod.rs
index 35738320715..6f8b63953e2 100644
--- a/src/libcollections/hash/mod.rs
+++ b/src/libcollections/hash/mod.rs
@@ -155,29 +155,36 @@ macro_rules! impl_hash_tuple(
         }
     );
 
-    ($A:ident $($B:ident)*) => (
-        impl<
-            S: Writer,
-            $A: Hash<S> $(, $B: Hash<S>)*
-        > Hash<S> for ($A, $($B),*) {
+    ( $($name:ident)+) => (
+        impl<S: Writer, $($name: Hash<S>),*> Hash<S> for ($($name,)*) {
+            #[allow(uppercase_variables)]
             #[inline]
             fn hash(&self, state: &mut S) {
                 match *self {
-                    (ref $A, $(ref $B),*) => {
-                        $A.hash(state);
+                    ($(ref $name,)*) => {
                         $(
-                            $B.hash(state);
+                            $name.hash(state);
                         )*
                     }
                 }
             }
         }
-
-        impl_hash_tuple!($($B)*)
     );
 )
 
-impl_hash_tuple!(a0 a1 a2 a3 a4 a5 a6 a7)
+impl_hash_tuple!()
+impl_hash_tuple!(A)
+impl_hash_tuple!(A B)
+impl_hash_tuple!(A B C)
+impl_hash_tuple!(A B C D)
+impl_hash_tuple!(A B C D E)
+impl_hash_tuple!(A B C D E F)
+impl_hash_tuple!(A B C D E F G)
+impl_hash_tuple!(A B C D E F G H)
+impl_hash_tuple!(A B C D E F G H I)
+impl_hash_tuple!(A B C D E F G H I J)
+impl_hash_tuple!(A B C D E F G H I J K)
+impl_hash_tuple!(A B C D E F G H I J K L)
 
 impl<'a, S: Writer, T: Hash<S>> Hash<S> for &'a [T] {
     #[inline]