diff --git a/base58/src/lib.rs b/base58/src/lib.rs index 138654408..b19759284 100644 --- a/base58/src/lib.rs +++ b/base58/src/lib.rs @@ -251,6 +251,7 @@ where #[cfg(test)] mod tests { use alloc::vec; + use hex::FromHex as _; use super::*; diff --git a/bitcoin/src/blockdata/witness.rs b/bitcoin/src/blockdata/witness.rs index 8231bbe9d..a4859a02b 100644 --- a/bitcoin/src/blockdata/witness.rs +++ b/bitcoin/src/blockdata/witness.rs @@ -361,7 +361,8 @@ mod test { #[test] fn consensus_serialize() { - let el_0 = hex!("03d2e15674941bad4a996372cb87e1856d3652606d98562fe39c5e9e7e413f2105").to_vec(); + let el_0 = + hex!("03d2e15674941bad4a996372cb87e1856d3652606d98562fe39c5e9e7e413f2105").to_vec(); let el_1 = hex!("000000").to_vec(); let mut want_witness = Witness::default(); diff --git a/bitcoin/src/merkle_tree/block.rs b/bitcoin/src/merkle_tree/block.rs index 2ddc30ef8..fe6589bd3 100644 --- a/bitcoin/src/merkle_tree/block.rs +++ b/bitcoin/src/merkle_tree/block.rs @@ -512,6 +512,8 @@ impl std::error::Error for MerkleBlockError { #[cfg(test)] mod tests { + use hex::{DisplayHex, FromHex}; + use hex_lit::hex; #[cfg(feature = "rand-std")] use {core::cmp, secp256k1::rand::prelude::*}; @@ -519,8 +521,6 @@ mod tests { use crate::block::{BlockUncheckedExt as _, Unchecked}; use crate::consensus::encode; use crate::hash_types::Txid; - use hex::{DisplayHex, FromHex}; - use hex_lit::hex; #[cfg(feature = "rand-std")] macro_rules! pmt_tests { diff --git a/bitcoin/src/taproot/mod.rs b/bitcoin/src/taproot/mod.rs index 3e513a78e..e4a60a35b 100644 --- a/bitcoin/src/taproot/mod.rs +++ b/bitcoin/src/taproot/mod.rs @@ -789,7 +789,9 @@ impl TryFrom for TapTree { /// /// A [`TapTree`] iff the `builder` is complete, otherwise return [`IncompleteBuilderError`] /// error with the content of incomplete `builder` instance. - fn try_from(builder: TaprootBuilder) -> Result { builder.try_into_tap_tree() } + fn try_from(builder: TaprootBuilder) -> Result { + builder.try_into_tap_tree() + } } impl TryFrom for TapTree { diff --git a/primitives/src/block.rs b/primitives/src/block.rs index 01aee8b1e..42e6ca10e 100644 --- a/primitives/src/block.rs +++ b/primitives/src/block.rs @@ -223,7 +223,8 @@ impl fmt::Display for Header { self.time.to_u32().to_le_bytes().as_hex(), self.bits.to_consensus().to_le_bytes().as_hex(), self.nonce.to_le_bytes().as_hex(), - ).expect("total length of written objects is 160 characters"); + ) + .expect("total length of written objects is 160 characters"); fmt::Display::fmt(&buf, f) } } diff --git a/primitives/src/witness.rs b/primitives/src/witness.rs index a00e98653..96d1b4747 100644 --- a/primitives/src/witness.rs +++ b/primitives/src/witness.rs @@ -901,7 +901,7 @@ mod test { let witness4: Witness = empty_data.iter().collect(); assert!(witness4.is_empty()); } - + #[cfg(feature = "hex")] #[test] fn test_from_hex() { diff --git a/units/src/amount/result.rs b/units/src/amount/result.rs index e2c2ddcaf..713cba4b0 100644 --- a/units/src/amount/result.rs +++ b/units/src/amount/result.rs @@ -7,8 +7,8 @@ use core::ops; use NumOpResult as R; use super::{Amount, SignedAmount}; +use crate::internal_macros::{impl_div_assign, impl_mul_assign}; use crate::{MathOp, NumOpError, NumOpResult, OptionExt}; -use crate::internal_macros::{impl_mul_assign, impl_div_assign}; impl From for NumOpResult { fn from(a: Amount) -> Self { Self::Valid(a) } diff --git a/units/src/amount/tests.rs b/units/src/amount/tests.rs index 5f240fb63..a9b19c13c 100644 --- a/units/src/amount/tests.rs +++ b/units/src/amount/tests.rs @@ -24,14 +24,10 @@ fn sat(sat: u64) -> Amount { Amount::from_sat(sat).unwrap() } fn ssat(ssat: i64) -> SignedAmount { SignedAmount::from_sat(ssat).unwrap() } #[track_caller] -fn res(n_sat: u64) -> NumOpResult{ - NumOpResult::from(sat(n_sat)) -} +fn res(n_sat: u64) -> NumOpResult { NumOpResult::from(sat(n_sat)) } #[track_caller] -fn sres(n_sat: i64) -> NumOpResult{ - NumOpResult::from(ssat(n_sat)) -} +fn sres(n_sat: i64) -> NumOpResult { NumOpResult::from(ssat(n_sat)) } #[test] fn sanity_check() { diff --git a/units/src/result.rs b/units/src/result.rs index 3d1ee003d..439cd8c7b 100644 --- a/units/src/result.rs +++ b/units/src/result.rs @@ -2,8 +2,8 @@ //! Provides a monodic type returned by mathematical operations (`core::ops`). -use core::fmt; use core::convert::Infallible; +use core::fmt; use NumOpResult as R;