diff --git a/bitcoin/src/crypto/ecdsa.rs b/bitcoin/src/crypto/ecdsa.rs index b29c64e1b..f6c2c7857 100644 --- a/bitcoin/src/crypto/ecdsa.rs +++ b/bitcoin/src/crypto/ecdsa.rs @@ -323,7 +323,7 @@ impl<'a> Arbitrary<'a> for Signature { signature_bytes[..32].copy_from_slice(&bytes); signature_bytes[32..].copy_from_slice(&bytes); - Ok(Signature{ + Ok(Signature { signature: secp256k1::ecdsa::Signature::from_compact(&signature_bytes).unwrap(), sighash_type: EcdsaSighashType::arbitrary(u)?, }) diff --git a/bitcoin/src/crypto/sighash.rs b/bitcoin/src/crypto/sighash.rs index 53b7e0dcc..f1faa5efd 100644 --- a/bitcoin/src/crypto/sighash.rs +++ b/bitcoin/src/crypto/sighash.rs @@ -1479,7 +1479,7 @@ impl<'a> Arbitrary<'a> for EcdsaSighashType { 2 => Ok(EcdsaSighashType::Single), 3 => Ok(EcdsaSighashType::AllPlusAnyoneCanPay), 4 => Ok(EcdsaSighashType::NonePlusAnyoneCanPay), - _ => Ok(EcdsaSighashType::SinglePlusAnyoneCanPay) + _ => Ok(EcdsaSighashType::SinglePlusAnyoneCanPay), } } } @@ -1495,7 +1495,7 @@ impl<'a> Arbitrary<'a> for TapSighashType { 3 => Ok(TapSighashType::Single), 4 => Ok(TapSighashType::AllPlusAnyoneCanPay), 5 => Ok(TapSighashType::NonePlusAnyoneCanPay), - _ => Ok(TapSighashType::SinglePlusAnyoneCanPay) + _ => Ok(TapSighashType::SinglePlusAnyoneCanPay), } } } diff --git a/hashes/src/siphash24.rs b/hashes/src/siphash24.rs index f150f0564..4a20cf640 100644 --- a/hashes/src/siphash24.rs +++ b/hashes/src/siphash24.rs @@ -80,9 +80,9 @@ pub struct HashEngine { k0: u64, k1: u64, bytes_hashed: u64, // how many bytes we've processed - state: State, // hash State - tail: u64, // unprocessed bytes le - ntail: usize, // how many bytes in tail are valid + state: State, // hash State + tail: u64, // unprocessed bytes le + ntail: usize, // how many bytes in tail are valid } impl HashEngine { @@ -134,7 +134,8 @@ impl crate::HashEngine for HashEngine { if self.ntail != 0 { needed = 8 - self.ntail; - self.tail |= unsafe { u8to64_le(msg, 0, cmp::min(bytes_hashed, needed)) } << (8 * self.ntail); + self.tail |= + unsafe { u8to64_le(msg, 0, cmp::min(bytes_hashed, needed)) } << (8 * self.ntail); if bytes_hashed < needed { self.ntail += bytes_hashed; return; diff --git a/primitives/src/sequence.rs b/primitives/src/sequence.rs index b9f4d3e6e..2d8a84760 100644 --- a/primitives/src/sequence.rs +++ b/primitives/src/sequence.rs @@ -256,7 +256,7 @@ impl<'a> Arbitrary<'a> for Sequence { 5 => Ok(Sequence::from_consensus(relative::Height::MAX.to_consensus_u32())), 6 => Ok(Sequence::from_consensus(relative::Time::MIN.to_consensus_u32())), 7 => Ok(Sequence::from_consensus(relative::Time::MAX.to_consensus_u32())), - _ => Ok(Sequence(u.arbitrary()?)) + _ => Ok(Sequence(u.arbitrary()?)), } } } @@ -272,7 +272,7 @@ impl<'a> Arbitrary<'a> for Sequence { 1 => Ok(Sequence::ZERO), 2 => Ok(Sequence::MIN_NO_RBF), 3 => Ok(Sequence::ENABLE_RBF_NO_LOCKTIME), - _ => Ok(Sequence(u.arbitrary()?)) + _ => Ok(Sequence(u.arbitrary()?)), } } } diff --git a/primitives/src/transaction.rs b/primitives/src/transaction.rs index 98a741a00..cd6897dac 100644 --- a/primitives/src/transaction.rs +++ b/primitives/src/transaction.rs @@ -81,7 +81,7 @@ impl<'a> Arbitrary<'a> for Version { match choice { 0 => Ok(Version::ONE), 1 => Ok(Version::TWO), - _ => Ok(Version(u.arbitrary()?)) + _ => Ok(Version(u.arbitrary()?)), } } } diff --git a/units/src/fee_rate.rs b/units/src/fee_rate.rs index 7edc8cc17..575187e49 100644 --- a/units/src/fee_rate.rs +++ b/units/src/fee_rate.rs @@ -3,7 +3,7 @@ //! Implements `FeeRate` and assoctiated features. use core::fmt; -use core::ops::{Add, Sub, Div, Mul, AddAssign, SubAssign}; +use core::ops::{Add, AddAssign, Div, Mul, Sub, SubAssign}; #[cfg(feature = "arbitrary")] use arbitrary::{Arbitrary, Unstructured}; @@ -154,25 +154,19 @@ impl Add for FeeRate { impl Add for &FeeRate { type Output = FeeRate; - fn add(self, other: FeeRate) -> ::Output { - FeeRate(self.0 + other.0) - } + fn add(self, other: FeeRate) -> ::Output { FeeRate(self.0 + other.0) } } impl Add<&FeeRate> for FeeRate { type Output = FeeRate; - fn add(self, other: &FeeRate) -> ::Output { - FeeRate(self.0 + other.0) - } + fn add(self, other: &FeeRate) -> ::Output { FeeRate(self.0 + other.0) } } impl<'a, 'b> Add<&'a FeeRate> for &'b FeeRate { type Output = FeeRate; - fn add(self, other: &'a FeeRate) -> ::Output { - FeeRate(self.0 + other.0) - } + fn add(self, other: &'a FeeRate) -> ::Output { FeeRate(self.0 + other.0) } } impl Sub for FeeRate { @@ -184,25 +178,19 @@ impl Sub for FeeRate { impl Sub for &FeeRate { type Output = FeeRate; - fn sub(self, other: FeeRate) -> ::Output { - FeeRate(self.0 - other.0) - } + fn sub(self, other: FeeRate) -> ::Output { FeeRate(self.0 - other.0) } } impl Sub<&FeeRate> for FeeRate { type Output = FeeRate; - fn sub(self, other: &FeeRate) -> ::Output { - FeeRate(self.0 - other.0) - } + fn sub(self, other: &FeeRate) -> ::Output { FeeRate(self.0 - other.0) } } impl<'a, 'b> Sub<&'a FeeRate> for &'b FeeRate { type Output = FeeRate; - fn sub(self, other: &'a FeeRate) -> ::Output { - FeeRate(self.0 - other.0) - } + fn sub(self, other: &'a FeeRate) -> ::Output { FeeRate(self.0 - other.0) } } /// Computes the ceiling so that the fee computation is conservative.