From aabf2d16815a49229332baef84acd1eda204fb4d Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Mon, 24 Jan 2022 13:05:45 +1100 Subject: [PATCH] Use brace not parenth fo macro arm Macro match arms can use any parenthesis-like character (it seems), however since we are delimiting a block of code elect to use braces. --- src/consensus/encode.rs | 12 ++++++------ src/util/uint.rs | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/consensus/encode.rs b/src/consensus/encode.rs index 68725203..03381d42 100644 --- a/src/consensus/encode.rs +++ b/src/consensus/encode.rs @@ -334,7 +334,7 @@ pub struct CheckedData(pub Vec); // Primitive types macro_rules! impl_int_encodable { - ($ty:ident, $meth_dec:ident, $meth_enc:ident) => ( + ($ty:ident, $meth_dec:ident, $meth_enc:ident) => { impl Decodable for $ty { #[inline] fn consensus_decode(mut d: D) -> Result { @@ -348,7 +348,7 @@ macro_rules! impl_int_encodable { Ok(mem::size_of::<$ty>()) } } - ) + } } impl_int_encodable!(u8, read_u8, emit_u8); @@ -494,7 +494,7 @@ impl Decodable for Cow<'static, str> { // Arrays macro_rules! impl_array { - ( $size:expr ) => ( + ( $size:expr ) => { impl Encodable for [u8; $size] { #[inline] fn consensus_encode(&self, mut s: S) -> Result { @@ -511,7 +511,7 @@ macro_rules! impl_array { Ok(ret) } } - ); + }; } impl_array!(2); @@ -702,7 +702,7 @@ impl Encodable for sync::Arc { // Tuples macro_rules! tuple_encode { - ($($x:ident),*) => ( + ($($x:ident),*) => { impl <$($x: Encodable),*> Encodable for ($($x),*) { #[inline] #[allow(non_snake_case)] @@ -724,7 +724,7 @@ macro_rules! tuple_encode { Ok(($({let $x = Decodable::consensus_decode(&mut d)?; $x }),*)) } } - ); + }; } tuple_encode!(T0, T1); diff --git a/src/util/uint.rs b/src/util/uint.rs index dc95dc16..b85ede06 100644 --- a/src/util/uint.rs +++ b/src/util/uint.rs @@ -19,7 +19,7 @@ //! macro_rules! construct_uint { - ($name:ident, $n_words:expr) => ( + ($name:ident, $n_words:expr) => { /// Little-endian large integer type #[derive(Copy, Clone, PartialEq, Eq, Hash, Default)] pub struct $name(pub [u64; $n_words]); @@ -505,7 +505,7 @@ macro_rules! construct_uint { } } } - ); + }; } construct_uint!(Uint256, 4);