]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Fix some double-indentation in util/ser
authorMatt Corallo <git@bluematt.me>
Wed, 12 Sep 2018 17:20:20 +0000 (13:20 -0400)
committerMatt Corallo <git@bluematt.me>
Wed, 12 Sep 2018 17:22:42 +0000 (13:22 -0400)
src/util/ser.rs

index 0a247d41a67d532c3ffd77c6ad2ff2938760fadc..1944519d05316186f3bec612ac8d5b8612523e0c 100644 (file)
@@ -183,7 +183,7 @@ impl<R, K, V> Readable<R> for HashMap<K, V>
                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<W: Write, T: Writeable<W>> Writeable<W> for Vec<T> {
                                .checked_mul(mem::size_of::<T>())
                                .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<u8>
@@ -211,16 +211,16 @@ impl<W: Write, T: Writeable<W>> Writeable<W> for Vec<T> {
 impl<R: Read, T: Readable<R>> Readable<R> for Vec<T> {
        #[inline]
        fn read(r: &mut Reader<R>) -> Result<Self, DecodeError> {
-                       let len: u16 = Readable::read(r)?;
-                       let byte_size = (len as usize)
-                                       .checked_mul(mem::size_of::<T>())
-                                       .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::<T>())
+                               .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)
        }
 }