diff --git a/bitcoin/src/blockdata/block.rs b/bitcoin/src/blockdata/block.rs index 7558beefb..e36c94a9b 100644 --- a/bitcoin/src/blockdata/block.rs +++ b/bitcoin/src/blockdata/block.rs @@ -657,10 +657,7 @@ mod tests { ); assert_eq!(real_decode.total_size(), some_block.len()); assert_eq!(block_base_size(real_decode.transactions()), some_block.len()); - assert_eq!( - real_decode.weight(), - Weight::from_vb_unchecked(some_block.len().to_u64()) - ); + assert_eq!(real_decode.weight(), Weight::from_vb_unchecked(some_block.len().to_u64())); assert_eq!(serialize(&real_decode), some_block); } diff --git a/bitcoin/src/blockdata/transaction.rs b/bitcoin/src/blockdata/transaction.rs index 51210477b..c8f378792 100644 --- a/bitcoin/src/blockdata/transaction.rs +++ b/bitcoin/src/blockdata/transaction.rs @@ -181,7 +181,7 @@ internal_macros::define_extension_trait! { /// Returns the total number of bytes that this input contributes to a transaction. /// /// Total size includes the witness data (for base size see [`Self::base_size`]). - /// + /// /// # Panics /// /// If the size calculation overflows. diff --git a/consensus_encoding/src/encode/encoders.rs b/consensus_encoding/src/encode/encoders.rs index 0c3465057..4b617edf9 100644 --- a/consensus_encoding/src/encode/encoders.rs +++ b/consensus_encoding/src/encode/encoders.rs @@ -26,9 +26,7 @@ pub struct BytesEncoder<'sl> { impl<'sl> BytesEncoder<'sl> { /// Constructs a byte encoder which encodes the given byte slice, with no length prefix. - pub fn without_length_prefix(sl: &'sl [u8]) -> Self { - Self { sl: Some(sl) } - } + pub fn without_length_prefix(sl: &'sl [u8]) -> Self { Self { sl: Some(sl) } } } impl Encoder for BytesEncoder<'_> { @@ -255,9 +253,7 @@ mod tests { where Self: 's; - fn encoder(&self) -> Self::Encoder<'_> { - BytesEncoder::without_length_prefix(self.0) - } + fn encoder(&self) -> Self::Encoder<'_> { BytesEncoder::without_length_prefix(self.0) } } struct TestArray([u8; N]); @@ -315,7 +311,6 @@ mod tests { assert_eq!(encoder.current_chunk(), None); } - #[test] fn encode_slice_with_elements() { // Should have the element chunks, then exhausted. diff --git a/fuzz/fuzz_targets/units/arbitrary_weight.rs b/fuzz/fuzz_targets/units/arbitrary_weight.rs index b50c917f0..93ce2d82d 100644 --- a/fuzz/fuzz_targets/units/arbitrary_weight.rs +++ b/fuzz/fuzz_targets/units/arbitrary_weight.rs @@ -33,9 +33,7 @@ fn do_test(data: &[u8]) { } // Constructors that return a Weight - for constructor in - [Weight::from_wu] - { + for constructor in [Weight::from_wu] { if let Ok(val) = u.arbitrary() { constructor(val); } else { diff --git a/hashes/src/sha256t/mod.rs b/hashes/src/sha256t/mod.rs index a0ca15d6d..b88047912 100644 --- a/hashes/src/sha256t/mod.rs +++ b/hashes/src/sha256t/mod.rs @@ -192,9 +192,9 @@ macro_rules! sha256t_tag_constructor { #[cfg(test)] mod tests { - use crate::sha256t; #[cfg(feature = "alloc")] use crate::sha256; + use crate::sha256t; const TEST_MIDSTATE: [u8; 32] = [ 156, 224, 228, 230, 124, 17, 108, 57, 56, 179, 202, 242, 195, 15, 80, 137, 211, 243, 147, diff --git a/primitives/src/script/borrowed.rs b/primitives/src/script/borrowed.rs index 31c962ea6..940db85f7 100644 --- a/primitives/src/script/borrowed.rs +++ b/primitives/src/script/borrowed.rs @@ -165,12 +165,10 @@ impl Encodable for Script { Self: 'a; fn encoder(&self) -> Self::Encoder<'_> { - ScriptEncoder( - Encoder2::new( - CompactSizeEncoder::new(self.as_bytes().len()), - BytesEncoder::without_length_prefix(self.as_bytes()) - ) - ) + ScriptEncoder(Encoder2::new( + CompactSizeEncoder::new(self.as_bytes().len()), + BytesEncoder::without_length_prefix(self.as_bytes()), + )) } } diff --git a/units/src/amount/tests.rs b/units/src/amount/tests.rs index 4a702e45e..37e0770ae 100644 --- a/units/src/amount/tests.rs +++ b/units/src/amount/tests.rs @@ -11,9 +11,9 @@ use core::num::{NonZeroI64, NonZeroU64}; use std::panic; use super::*; -use crate::result::NumOpResult; #[cfg(feature = "alloc")] use crate::result::MathOp; +use crate::result::NumOpResult; #[cfg(feature = "alloc")] use crate::{FeeRate, Weight}; diff --git a/units/src/weight.rs b/units/src/weight.rs index 4b67a2eb2..95a6018bd 100644 --- a/units/src/weight.rs +++ b/units/src/weight.rs @@ -100,7 +100,7 @@ impl Weight { pub const fn from_witness_data_size(witness_size: u64) -> Self { Weight::from_wu(witness_size) } /// Constructs a new [`Weight`] from non-witness size. - /// + /// /// # Panics /// /// If the conversion from virtual bytes overflows.