Merge rust-bitcoin/rust-bitcoin#2976: Automated nightly rustfmt (2024-07-07)

91382977fb 2024-07-07 automated rustfmt nightly (Fmt Bot)

Pull request description:

  Automated nightly `rustfmt` changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action

ACKs for top commit:
  apoelstra:
    ACK 91382977fb
  tcharding:
    ACK 91382977fb

Tree-SHA512: 8729e3ca874d1269cd4396a21b79da95d3775e91985429f08c2ca4f77fac2c44c5b16183c1ccefcf40a6e12c3836a0ab7b035f4dfcb3b715ff4f954f6d7443e1
This commit is contained in:
merge-script 2024-07-08 14:05:29 +10:00
commit 4507cd1fe7
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
14 changed files with 19 additions and 24 deletions

View File

@ -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;

View File

@ -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];

View File

@ -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.
/// ///

View File

@ -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 {

View File

@ -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};

View File

@ -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 {

View File

@ -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;

View File

@ -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};

View File

@ -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;

View File

@ -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};

View File

@ -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::*;

View File

@ -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;

View File

@ -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.