From 39ec59620db53de3a69e2368619332611f36a73a Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Mon, 24 Jan 2022 12:36:46 +1100 Subject: [PATCH] Fix unusual indentation We have a few instances of strange indentation: - Incorrect number of characters - Usage of neither "Block" style or "View" style (elect to use "Block") --- src/blockdata/opcodes.rs | 4 ++-- src/consensus/encode.rs | 4 ++-- src/util/base58.rs | 6 +++--- src/util/bip32.rs | 10 +++++----- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/blockdata/opcodes.rs b/src/blockdata/opcodes.rs index 9ba453c4..fbc1e152 100644 --- a/src/blockdata/opcodes.rs +++ b/src/blockdata/opcodes.rs @@ -860,8 +860,8 @@ impl Ordinary { /// Encode as a byte #[inline] pub fn into_u8(self) -> u8 { - self as u8 - } + self as u8 + } } #[cfg(test)] diff --git a/src/consensus/encode.rs b/src/consensus/encode.rs index 3cc4899c..f46abd0f 100644 --- a/src/consensus/encode.rs +++ b/src/consensus/encode.rs @@ -570,8 +570,8 @@ macro_rules! impl_vec { fn consensus_decode(mut d: D) -> Result { let len = VarInt::consensus_decode(&mut d)?.0; let byte_size = (len as usize) - .checked_mul(mem::size_of::<$type>()) - .ok_or(self::Error::ParseFailed("Invalid length"))?; + .checked_mul(mem::size_of::<$type>()) + .ok_or(self::Error::ParseFailed("Invalid length"))?; if byte_size > MAX_VEC_SIZE { return Err(self::Error::OversizedVectorAllocation { requested: byte_size, max: MAX_VEC_SIZE }) } diff --git a/src/util/base58.rs b/src/util/base58.rs index af52481d..7ad941b8 100644 --- a/src/util/base58.rs +++ b/src/util/base58.rs @@ -293,10 +293,10 @@ mod tests { // Addresses let addr = Vec::from_hex("00f8917303bfa8ef24f292e8fa1419b20460ba064d").unwrap(); assert_eq!(&check_encode_slice(&addr[..]), "1PfJpZsjreyVrqeoAfabrRwwjQyoSQMmHH"); - } + } - #[test] - fn test_base58_decode() { + #[test] + fn test_base58_decode() { // Basics assert_eq!(from("1").ok(), Some(vec![0u8])); assert_eq!(from("2").ok(), Some(vec![1u8])); diff --git a/src/util/bip32.rs b/src/util/bip32.rs index 6008c348..769122d2 100644 --- a/src/util/bip32.rs +++ b/src/util/bip32.rs @@ -486,11 +486,11 @@ impl fmt::Display for Error { #[cfg_attr(docsrs, doc(cfg(feature = "std")))] impl error::Error for Error { fn cause(&self) -> Option<&dyn error::Error> { - if let Error::Secp256k1(ref e) = *self { - Some(e) - } else { - None - } + if let Error::Secp256k1(ref e) = *self { + Some(e) + } else { + None + } } }