From: Matt Corallo Date: Wed, 12 Sep 2018 17:20:20 +0000 (-0400) Subject: Fix some double-indentation in util/ser X-Git-Tag: v0.0.12~315^2~1 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=c3e225597d3981410644b84ad1e7b02c7a6bc7c7;p=rust-lightning Fix some double-indentation in util/ser --- diff --git a/src/util/ser.rs b/src/util/ser.rs index 0a247d41a..1944519d0 100644 --- a/src/util/ser.rs +++ b/src/util/ser.rs @@ -183,7 +183,7 @@ impl Readable for HashMap let len: u16 = Readable::read(r)?; let mut ret = HashMap::with_capacity(len as usize); for _ in 0..len { - ret.insert(K::read(r)?, V::read(r)?); + ret.insert(K::read(r)?, V::read(r)?); } Ok(ret) } @@ -197,7 +197,7 @@ impl> Writeable for Vec { .checked_mul(mem::size_of::()) .ok_or(DecodeError::BadLengthDescriptor)?; if byte_size > MAX_BUF_SIZE { - return Err(DecodeError::BadLengthDescriptor); + return Err(DecodeError::BadLengthDescriptor); } (self.len() as u16).write(w)?; // performance with Vec @@ -211,16 +211,16 @@ impl> Writeable for Vec { impl> Readable for Vec { #[inline] fn read(r: &mut Reader) -> Result { - let len: u16 = Readable::read(r)?; - let byte_size = (len as usize) - .checked_mul(mem::size_of::()) - .ok_or(DecodeError::BadLengthDescriptor)?; - if byte_size > MAX_BUF_SIZE { - return Err(DecodeError::BadLengthDescriptor); - } - let mut ret = Vec::with_capacity(len as usize); - for _ in 0..len { ret.push(T::read(r)?); } - Ok(ret) + let len: u16 = Readable::read(r)?; + let byte_size = (len as usize) + .checked_mul(mem::size_of::()) + .ok_or(DecodeError::BadLengthDescriptor)?; + if byte_size > MAX_BUF_SIZE { + return Err(DecodeError::BadLengthDescriptor); + } + let mut ret = Vec::with_capacity(len as usize); + for _ in 0..len { ret.push(T::read(r)?); } + Ok(ret) } }