From c3e225597d3981410644b84ad1e7b02c7a6bc7c7 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 12 Sep 2018 13:20:20 -0400 Subject: [PATCH] Fix some double-indentation in util/ser --- src/util/ser.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) 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) } } -- 2.39.5