Merge rust-bitcoin/rust-bitcoin#4401: Automated nightly rustfmt (2025-04-27)

6737c3a0e5 2025-04-27 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 6737c3a0e59173b11431bd0c31a1202ca4ce7369; successfully ran local tests

Tree-SHA512: d486efcc34aa7a3666ec421e8ae7d8f1d2f160a3ba8b086b70859f1da4fc03bb1399886370e09c26c57be98c20bdb865b86547f2f7dbcfcace2d34d486f842e0
This commit is contained in:
merge-script 2025-04-27 03:20:25 +00:00
commit 269cd3ae35
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
10 changed files with 17 additions and 18 deletions

View File

@ -251,6 +251,7 @@ where
#[cfg(test)]
mod tests {
use alloc::vec;
use hex::FromHex as _;
use super::*;

View File

@ -224,13 +224,11 @@ mod tests {
let arbitrary_bytes = [0x00; 32];
assert!(WitnessProgram::new(WitnessVersion::V1, &arbitrary_bytes)
.expect("valid witness program")
.is_p2tr()
);
.is_p2tr());
let p2a_bytes = [78, 115];
assert!(WitnessProgram::new(WitnessVersion::V1, &p2a_bytes)
.expect("valid witness program")
.is_p2a()
);
.is_p2a());
}
}

View File

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

View File

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

View File

@ -789,7 +789,9 @@ impl TryFrom<TaprootBuilder> 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<Self, Self::Error> { builder.try_into_tap_tree() }
fn try_from(builder: TaprootBuilder) -> Result<Self, Self::Error> {
builder.try_into_tap_tree()
}
}
impl TryFrom<NodeInfo> for TapTree {

View File

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

View File

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

View File

@ -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<Amount> for NumOpResult<Amount> {
fn from(a: Amount) -> Self { Self::Valid(a) }

View File

@ -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<Amount>{
NumOpResult::from(sat(n_sat))
}
fn res(n_sat: u64) -> NumOpResult<Amount> { NumOpResult::from(sat(n_sat)) }
#[track_caller]
fn sres(n_sat: i64) -> NumOpResult<SignedAmount>{
NumOpResult::from(ssat(n_sat))
}
fn sres(n_sat: i64) -> NumOpResult<SignedAmount> { NumOpResult::from(ssat(n_sat)) }
#[test]
fn sanity_check() {

View File

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