2024-07-07 automated rustfmt nightly
This commit is contained in:
parent
59a3b2b683
commit
91382977fb
|
@ -48,7 +48,7 @@ use crate::block::{Block, BlockHash};
|
||||||
use crate::consensus::encode::VarInt;
|
use crate::consensus::encode::VarInt;
|
||||||
use crate::consensus::{Decodable, Encodable};
|
use crate::consensus::{Decodable, Encodable};
|
||||||
use crate::internal_macros::impl_hashencode;
|
use crate::internal_macros::impl_hashencode;
|
||||||
use crate::prelude::{Borrow, BTreeSet, Vec};
|
use crate::prelude::{BTreeSet, Borrow, Vec};
|
||||||
use crate::script::Script;
|
use crate::script::Script;
|
||||||
use crate::transaction::OutPoint;
|
use crate::transaction::OutPoint;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ use secp256k1::{Secp256k1, XOnlyPublicKey};
|
||||||
use crate::crypto::key::{CompressedPublicKey, Keypair, PrivateKey};
|
use crate::crypto::key::{CompressedPublicKey, Keypair, PrivateKey};
|
||||||
use crate::internal_macros::impl_array_newtype_stringify;
|
use crate::internal_macros::impl_array_newtype_stringify;
|
||||||
use crate::network::NetworkKind;
|
use crate::network::NetworkKind;
|
||||||
use crate::prelude::{Vec, String};
|
use crate::prelude::{String, Vec};
|
||||||
|
|
||||||
/// Version bytes for extended public keys on the Bitcoin network.
|
/// Version bytes for extended public keys on the Bitcoin network.
|
||||||
const VERSION_BYTES_MAINNET_PUBLIC: [u8; 4] = [0x04, 0x88, 0xB2, 0x1E];
|
const VERSION_BYTES_MAINNET_PUBLIC: [u8; 4] = [0x04, 0x88, 0xB2, 0x1E];
|
||||||
|
|
|
@ -13,7 +13,7 @@ use crate::key::{PublicKey, UntweakedPublicKey, WPubkeyHash};
|
||||||
use crate::opcodes::all::*;
|
use crate::opcodes::all::*;
|
||||||
use crate::opcodes::{self, Opcode};
|
use crate::opcodes::{self, Opcode};
|
||||||
use crate::policy::DUST_RELAY_TX_FEE;
|
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::witness_version::WitnessVersion;
|
||||||
use crate::script::{
|
use crate::script::{
|
||||||
bytes_to_asm_fmt, Builder, Instruction, InstructionIndices, Instructions,
|
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
|
/// What this function considers to be standard may change without warning pending Bitcoin Core
|
||||||
/// changes.
|
/// changes.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_standard_op_return(&self) -> bool {
|
pub fn is_standard_op_return(&self) -> bool { self.is_op_return() && self.0.len() <= 80 }
|
||||||
self.is_op_return() && self.0.len() <= 80
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Checks whether a script is trivially known to have no satisfying input.
|
/// Checks whether a script is trivially known to have no satisfying input.
|
||||||
///
|
///
|
||||||
|
|
|
@ -565,9 +565,9 @@ mod test {
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::consensus::{deserialize, serialize};
|
use crate::consensus::{deserialize, serialize};
|
||||||
|
use crate::hex::DisplayHex;
|
||||||
use crate::sighash::EcdsaSighashType;
|
use crate::sighash::EcdsaSighashType;
|
||||||
use crate::Transaction;
|
use crate::Transaction;
|
||||||
use crate::hex::DisplayHex;
|
|
||||||
|
|
||||||
fn append_u32_vec(mut v: Vec<u8>, n: &[u32]) -> Vec<u8> {
|
fn append_u32_vec(mut v: Vec<u8>, n: &[u32]) -> Vec<u8> {
|
||||||
for &num in n {
|
for &num in n {
|
||||||
|
|
|
@ -31,7 +31,7 @@ use crate::p2p::{
|
||||||
address::{AddrV2Message, Address},
|
address::{AddrV2Message, Address},
|
||||||
message_blockdata::Inventory,
|
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::taproot::TapLeafHash;
|
||||||
use crate::transaction::{Transaction, TxIn, TxOut};
|
use crate::transaction::{Transaction, TxIn, TxOut};
|
||||||
|
|
||||||
|
|
|
@ -512,7 +512,7 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::consensus::encode;
|
use crate::consensus::encode;
|
||||||
use crate::hash_types::Txid;
|
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")]
|
#[cfg(feature = "rand-std")]
|
||||||
macro_rules! pmt_tests {
|
macro_rules! pmt_tests {
|
||||||
|
|
|
@ -5,7 +5,7 @@ use io::{BufRead, Cursor, Read};
|
||||||
use crate::bip32::{ChildNumber, DerivationPath, Fingerprint, Xpub};
|
use crate::bip32::{ChildNumber, DerivationPath, Fingerprint, Xpub};
|
||||||
use crate::consensus::encode::MAX_VEC_SIZE;
|
use crate::consensus::encode::MAX_VEC_SIZE;
|
||||||
use crate::consensus::{encode, Decodable};
|
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::map::Map;
|
||||||
use crate::psbt::{raw, Error, Psbt};
|
use crate::psbt::{raw, Error, Psbt};
|
||||||
use crate::transaction::Transaction;
|
use crate::transaction::Transaction;
|
||||||
|
|
|
@ -9,7 +9,7 @@ use secp256k1::XOnlyPublicKey;
|
||||||
use crate::bip32::KeySource;
|
use crate::bip32::KeySource;
|
||||||
use crate::crypto::key::PublicKey;
|
use crate::crypto::key::PublicKey;
|
||||||
use crate::crypto::{ecdsa, taproot};
|
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::map::Map;
|
||||||
use crate::psbt::serialize::Deserialize;
|
use crate::psbt::serialize::Deserialize;
|
||||||
use crate::psbt::{self, error, raw, Error};
|
use crate::psbt::{self, error, raw, Error};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
use secp256k1::XOnlyPublicKey;
|
use secp256k1::XOnlyPublicKey;
|
||||||
|
|
||||||
use crate::bip32::KeySource;
|
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::map::Map;
|
||||||
use crate::psbt::{raw, Error};
|
use crate::psbt::{raw, Error};
|
||||||
use crate::script::ScriptBuf;
|
use crate::script::ScriptBuf;
|
||||||
|
|
|
@ -24,7 +24,7 @@ use crate::bip32::{self, KeySource, Xpriv, Xpub};
|
||||||
use crate::crypto::key::{PrivateKey, PublicKey};
|
use crate::crypto::key::{PrivateKey, PublicKey};
|
||||||
use crate::crypto::{ecdsa, taproot};
|
use crate::crypto::{ecdsa, taproot};
|
||||||
use crate::key::{TapTweak, XOnlyPublicKey};
|
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::sighash::{self, EcdsaSighashType, Prevouts, SighashCache};
|
||||||
use crate::transaction::{self, Transaction, TxOut};
|
use crate::transaction::{self, Transaction, TxOut};
|
||||||
use crate::{Amount, FeeRate, TapLeafHash, TapSighashType};
|
use crate::{Amount, FeeRate, TapLeafHash, TapSighashType};
|
||||||
|
|
|
@ -18,7 +18,7 @@ use secp256k1::{Scalar, Secp256k1};
|
||||||
|
|
||||||
use crate::consensus::Encodable;
|
use crate::consensus::Encodable;
|
||||||
use crate::crypto::key::{TapTweak, TweakedPublicKey, UntweakedPublicKey, XOnlyPublicKey};
|
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};
|
use crate::{Script, ScriptBuf};
|
||||||
|
|
||||||
// Re-export these so downstream only has to use one `taproot` module.
|
// Re-export these so downstream only has to use one `taproot` module.
|
||||||
|
@ -1543,7 +1543,7 @@ mod test {
|
||||||
|
|
||||||
use hashes::sha256;
|
use hashes::sha256;
|
||||||
use hashes::sha256t::Tag;
|
use hashes::sha256t::Tag;
|
||||||
use hex::{FromHex, DisplayHex};
|
use hex::{DisplayHex, FromHex};
|
||||||
use secp256k1::VerifyOnly;
|
use secp256k1::VerifyOnly;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
|
@ -102,7 +102,7 @@ impl<T: GeneralHash> Hkdf<T> {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
mod tests {
|
mod tests {
|
||||||
use hex::prelude::{FromHex, DisplayHex};
|
use hex::prelude::{DisplayHex, FromHex};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::sha256;
|
use crate::sha256;
|
||||||
|
|
|
@ -738,7 +738,8 @@ fn fmt_satoshi_in(
|
||||||
if let Some(format_precision) = options.precision {
|
if let Some(format_precision) = options.precision {
|
||||||
if usize::from(precision) > format_precision {
|
if usize::from(precision) > format_precision {
|
||||||
// precision is u8 so in this branch options.precision() < 255 which fits in u32
|
// 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;
|
let remainder = satoshi % rounding_divisor;
|
||||||
satoshi -= remainder;
|
satoshi -= remainder;
|
||||||
if remainder / (rounding_divisor / 10) >= 5 {
|
if remainder / (rounding_divisor / 10) >= 5 {
|
||||||
|
@ -992,9 +993,7 @@ impl Amount {
|
||||||
///
|
///
|
||||||
/// Does not include the denomination.
|
/// Does not include the denomination.
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
pub fn to_string_in(self, denom: Denomination) -> String {
|
pub fn to_string_in(self, denom: Denomination) -> String { self.display_in(denom).to_string() }
|
||||||
self.display_in(denom).to_string()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get a formatted string of this [Amount] in the given denomination,
|
/// Get a formatted string of this [Amount] in the given denomination,
|
||||||
/// suffixed with the abbreviation for the denomination.
|
/// suffixed with the abbreviation for the denomination.
|
||||||
|
@ -1350,9 +1349,7 @@ impl SignedAmount {
|
||||||
///
|
///
|
||||||
/// Does not include the denomination.
|
/// Does not include the denomination.
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
pub fn to_string_in(self, denom: Denomination) -> String {
|
pub fn to_string_in(self, denom: Denomination) -> String { self.display_in(denom).to_string() }
|
||||||
self.display_in(denom).to_string()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get a formatted string of this [SignedAmount] in the given denomination,
|
/// Get a formatted string of this [SignedAmount] in the given denomination,
|
||||||
/// suffixed with the abbreviation for the denomination.
|
/// suffixed with the abbreviation for the denomination.
|
||||||
|
|
Loading…
Reference in New Issue