From: Matt Corallo Date: Wed, 24 Mar 2021 18:31:03 +0000 (-0400) Subject: Use more descriptive names in serialization impl macros X-Git-Tag: v0.0.14~13^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=refs%2Fheads%2F2021-03-fix-lens;p=rust-lightning Use more descriptive names in serialization impl macros --- diff --git a/lightning/src/util/ser_macros.rs b/lightning/src/util/ser_macros.rs index e99c4e0eb..5062bae76 100644 --- a/lightning/src/util/ser_macros.rs +++ b/lightning/src/util/ser_macros.rs @@ -145,11 +145,11 @@ macro_rules! impl_writeable { } } macro_rules! impl_writeable_len_match { - ($st:ident, $cmp: tt, {$({$m: pat, $l: expr}),*}, {$($field:ident),*}) => { - impl Writeable for $st { + ($struct: ident, $cmp: tt, {$({$match: pat, $length: expr}),*}, {$($field:ident),*}) => { + impl Writeable for $struct { fn write(&self, w: &mut W) -> Result<(), ::std::io::Error> { let len = match *self { - $($m => $l,)* + $($match => $length,)* }; w.size_hint(len); #[cfg(any(test, feature = "fuzztarget"))] @@ -165,7 +165,7 @@ macro_rules! impl_writeable_len_match { } } - impl ::util::ser::Readable for $st { + impl ::util::ser::Readable for $struct { fn read(r: &mut R) -> Result { Ok(Self { $($field: Readable::read(r)?),* @@ -173,8 +173,8 @@ macro_rules! impl_writeable_len_match { } } }; - ($st:ident, {$({$m: pat, $l: expr}),*}, {$($field:ident),*}) => { - impl_writeable_len_match!($st, ==, { $({ $m, $l }),* }, { $($field),* }); + ($struct: ident, {$({$match: pat, $length: expr}),*}, {$($field:ident),*}) => { + impl_writeable_len_match!($struct, ==, { $({ $match, $length }),* }, { $($field),* }); } }