diff --git a/bitcoin/src/bip158.rs b/bitcoin/src/bip158.rs index c90dc3652..f5a9d8e29 100644 --- a/bitcoin/src/bip158.rs +++ b/bitcoin/src/bip158.rs @@ -48,7 +48,7 @@ use crate::block::{Block, BlockHash}; use crate::consensus::encode::VarInt; use crate::consensus::{Decodable, Encodable}; use crate::internal_macros::impl_hashencode; -use crate::prelude::{Borrow, BTreeSet, Vec}; +use crate::prelude::{BTreeSet, Borrow, Vec}; use crate::script::Script; use crate::transaction::OutPoint; diff --git a/bitcoin/src/bip32.rs b/bitcoin/src/bip32.rs index 07033a05f..9e02581ee 100644 --- a/bitcoin/src/bip32.rs +++ b/bitcoin/src/bip32.rs @@ -16,7 +16,7 @@ use secp256k1::{Secp256k1, XOnlyPublicKey}; use crate::crypto::key::{CompressedPublicKey, Keypair, PrivateKey}; use crate::internal_macros::impl_array_newtype_stringify; use crate::network::NetworkKind; -use crate::prelude::{Vec, String}; +use crate::prelude::{String, Vec}; /// Version bytes for extended public keys on the Bitcoin network. const VERSION_BYTES_MAINNET_PUBLIC: [u8; 4] = [0x04, 0x88, 0xB2, 0x1E]; diff --git a/bitcoin/src/blockdata/script/borrowed.rs b/bitcoin/src/blockdata/script/borrowed.rs index 39881ec20..b8d735970 100644 --- a/bitcoin/src/blockdata/script/borrowed.rs +++ b/bitcoin/src/blockdata/script/borrowed.rs @@ -13,7 +13,7 @@ use crate::key::{PublicKey, UntweakedPublicKey, WPubkeyHash}; use crate::opcodes::all::*; use crate::opcodes::{self, Opcode}; use crate::policy::DUST_RELAY_TX_FEE; -use crate::prelude::{Box, DisplayHex, sink, String, ToOwned, Vec}; +use crate::prelude::{sink, Box, DisplayHex, String, ToOwned, Vec}; use crate::script::witness_version::WitnessVersion; use crate::script::{ bytes_to_asm_fmt, Builder, Instruction, InstructionIndices, Instructions, @@ -366,9 +366,7 @@ impl Script { /// What this function considers to be standard may change without warning pending Bitcoin Core /// changes. #[inline] - pub fn is_standard_op_return(&self) -> bool { - self.is_op_return() && self.0.len() <= 80 - } + pub fn is_standard_op_return(&self) -> bool { self.is_op_return() && self.0.len() <= 80 } /// Checks whether a script is trivially known to have no satisfying input. /// diff --git a/bitcoin/src/blockdata/witness.rs b/bitcoin/src/blockdata/witness.rs index ebbbdd942..59eba6896 100644 --- a/bitcoin/src/blockdata/witness.rs +++ b/bitcoin/src/blockdata/witness.rs @@ -565,9 +565,9 @@ mod test { use super::*; use crate::consensus::{deserialize, serialize}; + use crate::hex::DisplayHex; use crate::sighash::EcdsaSighashType; use crate::Transaction; - use crate::hex::DisplayHex; fn append_u32_vec(mut v: Vec, n: &[u32]) -> Vec { for &num in n { diff --git a/bitcoin/src/consensus/encode.rs b/bitcoin/src/consensus/encode.rs index 52f928d5f..c63c97dbb 100644 --- a/bitcoin/src/consensus/encode.rs +++ b/bitcoin/src/consensus/encode.rs @@ -31,7 +31,7 @@ use crate::p2p::{ address::{AddrV2Message, Address}, message_blockdata::Inventory, }; -use crate::prelude::{Box, Cow, DisplayHex, rc, String, sync, Vec}; +use crate::prelude::{rc, sync, Box, Cow, DisplayHex, String, Vec}; use crate::taproot::TapLeafHash; use crate::transaction::{Transaction, TxIn, TxOut}; diff --git a/bitcoin/src/crypto/key.rs b/bitcoin/src/crypto/key.rs index 0556fc00b..05c869e83 100644 --- a/bitcoin/src/crypto/key.rs +++ b/bitcoin/src/crypto/key.rs @@ -18,7 +18,7 @@ use io::{Read, Write}; use crate::crypto::ecdsa; use crate::internal_macros::impl_asref_push_bytes; use crate::network::NetworkKind; -use crate::prelude::{DisplayHex, String, Vec}; +use crate::prelude::{DisplayHex, String, Vec}; use crate::script::ScriptBuf; use crate::taproot::{TapNodeHash, TapTweakHash}; diff --git a/bitcoin/src/merkle_tree/block.rs b/bitcoin/src/merkle_tree/block.rs index 91fd7d5cc..f6b8a34fc 100644 --- a/bitcoin/src/merkle_tree/block.rs +++ b/bitcoin/src/merkle_tree/block.rs @@ -512,7 +512,7 @@ mod tests { use super::*; use crate::consensus::encode; use crate::hash_types::Txid; - use crate::hex::{test_hex_unwrap as hex, FromHex, DisplayHex}; + use crate::hex::{test_hex_unwrap as hex, DisplayHex, FromHex}; #[cfg(feature = "rand-std")] macro_rules! pmt_tests { diff --git a/bitcoin/src/psbt/map/global.rs b/bitcoin/src/psbt/map/global.rs index 44c6f27e6..839072fec 100644 --- a/bitcoin/src/psbt/map/global.rs +++ b/bitcoin/src/psbt/map/global.rs @@ -5,7 +5,7 @@ use io::{BufRead, Cursor, Read}; use crate::bip32::{ChildNumber, DerivationPath, Fingerprint, Xpub}; use crate::consensus::encode::MAX_VEC_SIZE; use crate::consensus::{encode, Decodable}; -use crate::prelude::{BTreeMap, btree_map, Vec}; +use crate::prelude::{btree_map, BTreeMap, Vec}; use crate::psbt::map::Map; use crate::psbt::{raw, Error, Psbt}; use crate::transaction::Transaction; diff --git a/bitcoin/src/psbt/map/input.rs b/bitcoin/src/psbt/map/input.rs index f5a7e2f69..7a713aef0 100644 --- a/bitcoin/src/psbt/map/input.rs +++ b/bitcoin/src/psbt/map/input.rs @@ -9,7 +9,7 @@ use secp256k1::XOnlyPublicKey; use crate::bip32::KeySource; use crate::crypto::key::PublicKey; use crate::crypto::{ecdsa, taproot}; -use crate::prelude::{Borrow, Box, BTreeMap, btree_map, ToOwned, Vec}; +use crate::prelude::{btree_map, BTreeMap, Borrow, Box, ToOwned, Vec}; use crate::psbt::map::Map; use crate::psbt::serialize::Deserialize; use crate::psbt::{self, error, raw, Error}; diff --git a/bitcoin/src/psbt/map/output.rs b/bitcoin/src/psbt/map/output.rs index d239d4674..184cac068 100644 --- a/bitcoin/src/psbt/map/output.rs +++ b/bitcoin/src/psbt/map/output.rs @@ -3,7 +3,7 @@ use secp256k1::XOnlyPublicKey; use crate::bip32::KeySource; -use crate::prelude::{BTreeMap, btree_map, Vec}; +use crate::prelude::{btree_map, BTreeMap, Vec}; use crate::psbt::map::Map; use crate::psbt::{raw, Error}; use crate::script::ScriptBuf; diff --git a/bitcoin/src/psbt/mod.rs b/bitcoin/src/psbt/mod.rs index 1ae87642a..fe230b3e8 100644 --- a/bitcoin/src/psbt/mod.rs +++ b/bitcoin/src/psbt/mod.rs @@ -24,7 +24,7 @@ use crate::bip32::{self, KeySource, Xpriv, Xpub}; use crate::crypto::key::{PrivateKey, PublicKey}; use crate::crypto::{ecdsa, taproot}; use crate::key::{TapTweak, XOnlyPublicKey}; -use crate::prelude::{Borrow, Box, BTreeMap, BTreeSet, btree_map, Vec}; +use crate::prelude::{btree_map, BTreeMap, BTreeSet, Borrow, Box, Vec}; use crate::sighash::{self, EcdsaSighashType, Prevouts, SighashCache}; use crate::transaction::{self, Transaction, TxOut}; use crate::{Amount, FeeRate, TapLeafHash, TapSighashType}; diff --git a/bitcoin/src/taproot/mod.rs b/bitcoin/src/taproot/mod.rs index b919753ba..571de54ae 100644 --- a/bitcoin/src/taproot/mod.rs +++ b/bitcoin/src/taproot/mod.rs @@ -18,7 +18,7 @@ use secp256k1::{Scalar, Secp256k1}; use crate::consensus::Encodable; use crate::crypto::key::{TapTweak, TweakedPublicKey, UntweakedPublicKey, XOnlyPublicKey}; -use crate::prelude::{BinaryHeap, BTreeMap, BTreeSet, Vec}; +use crate::prelude::{BTreeMap, BTreeSet, BinaryHeap, Vec}; use crate::{Script, ScriptBuf}; // Re-export these so downstream only has to use one `taproot` module. @@ -1543,7 +1543,7 @@ mod test { use hashes::sha256; use hashes::sha256t::Tag; - use hex::{FromHex, DisplayHex}; + use hex::{DisplayHex, FromHex}; use secp256k1::VerifyOnly; use super::*; diff --git a/hashes/src/hkdf.rs b/hashes/src/hkdf.rs index 92311d4f6..532d72c1b 100644 --- a/hashes/src/hkdf.rs +++ b/hashes/src/hkdf.rs @@ -102,7 +102,7 @@ impl Hkdf { #[cfg(test)] #[cfg(feature = "alloc")] mod tests { - use hex::prelude::{FromHex, DisplayHex}; + use hex::prelude::{DisplayHex, FromHex}; use super::*; use crate::sha256; diff --git a/units/src/amount.rs b/units/src/amount.rs index b68ae8ab4..8b9b78ba5 100644 --- a/units/src/amount.rs +++ b/units/src/amount.rs @@ -738,7 +738,8 @@ fn fmt_satoshi_in( if let Some(format_precision) = options.precision { if usize::from(precision) > format_precision { // precision is u8 so in this branch options.precision() < 255 which fits in u32 - let rounding_divisor = 10u64.pow(u32::from(precision) - format_precision as u32); + let rounding_divisor = + 10u64.pow(u32::from(precision) - format_precision as u32); let remainder = satoshi % rounding_divisor; satoshi -= remainder; if remainder / (rounding_divisor / 10) >= 5 { @@ -992,9 +993,7 @@ impl Amount { /// /// Does not include the denomination. #[cfg(feature = "alloc")] - pub fn to_string_in(self, denom: Denomination) -> String { - self.display_in(denom).to_string() - } + pub fn to_string_in(self, denom: Denomination) -> String { self.display_in(denom).to_string() } /// Get a formatted string of this [Amount] in the given denomination, /// suffixed with the abbreviation for the denomination. @@ -1350,9 +1349,7 @@ impl SignedAmount { /// /// Does not include the denomination. #[cfg(feature = "alloc")] - pub fn to_string_in(self, denom: Denomination) -> String { - self.display_in(denom).to_string() - } + pub fn to_string_in(self, denom: Denomination) -> String { self.display_in(denom).to_string() } /// Get a formatted string of this [SignedAmount] in the given denomination, /// suffixed with the abbreviation for the denomination.