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:
commit
269cd3ae35
|
@ -251,6 +251,7 @@ where
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use alloc::vec;
|
use alloc::vec;
|
||||||
|
|
||||||
use hex::FromHex as _;
|
use hex::FromHex as _;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
|
@ -224,13 +224,11 @@ mod tests {
|
||||||
let arbitrary_bytes = [0x00; 32];
|
let arbitrary_bytes = [0x00; 32];
|
||||||
assert!(WitnessProgram::new(WitnessVersion::V1, &arbitrary_bytes)
|
assert!(WitnessProgram::new(WitnessVersion::V1, &arbitrary_bytes)
|
||||||
.expect("valid witness program")
|
.expect("valid witness program")
|
||||||
.is_p2tr()
|
.is_p2tr());
|
||||||
);
|
|
||||||
|
|
||||||
let p2a_bytes = [78, 115];
|
let p2a_bytes = [78, 115];
|
||||||
assert!(WitnessProgram::new(WitnessVersion::V1, &p2a_bytes)
|
assert!(WitnessProgram::new(WitnessVersion::V1, &p2a_bytes)
|
||||||
.expect("valid witness program")
|
.expect("valid witness program")
|
||||||
.is_p2a()
|
.is_p2a());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,7 +361,8 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn consensus_serialize() {
|
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 el_1 = hex!("000000").to_vec();
|
||||||
|
|
||||||
let mut want_witness = Witness::default();
|
let mut want_witness = Witness::default();
|
||||||
|
|
|
@ -512,6 +512,8 @@ impl std::error::Error for MerkleBlockError {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use hex::{DisplayHex, FromHex};
|
||||||
|
use hex_lit::hex;
|
||||||
#[cfg(feature = "rand-std")]
|
#[cfg(feature = "rand-std")]
|
||||||
use {core::cmp, secp256k1::rand::prelude::*};
|
use {core::cmp, secp256k1::rand::prelude::*};
|
||||||
|
|
||||||
|
@ -519,8 +521,6 @@ mod tests {
|
||||||
use crate::block::{BlockUncheckedExt as _, Unchecked};
|
use crate::block::{BlockUncheckedExt as _, Unchecked};
|
||||||
use crate::consensus::encode;
|
use crate::consensus::encode;
|
||||||
use crate::hash_types::Txid;
|
use crate::hash_types::Txid;
|
||||||
use hex::{DisplayHex, FromHex};
|
|
||||||
use hex_lit::hex;
|
|
||||||
|
|
||||||
#[cfg(feature = "rand-std")]
|
#[cfg(feature = "rand-std")]
|
||||||
macro_rules! pmt_tests {
|
macro_rules! pmt_tests {
|
||||||
|
|
|
@ -789,7 +789,9 @@ impl TryFrom<TaprootBuilder> for TapTree {
|
||||||
///
|
///
|
||||||
/// A [`TapTree`] iff the `builder` is complete, otherwise return [`IncompleteBuilderError`]
|
/// A [`TapTree`] iff the `builder` is complete, otherwise return [`IncompleteBuilderError`]
|
||||||
/// error with the content of incomplete `builder` instance.
|
/// 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 {
|
impl TryFrom<NodeInfo> for TapTree {
|
||||||
|
|
|
@ -223,7 +223,8 @@ impl fmt::Display for Header {
|
||||||
self.time.to_u32().to_le_bytes().as_hex(),
|
self.time.to_u32().to_le_bytes().as_hex(),
|
||||||
self.bits.to_consensus().to_le_bytes().as_hex(),
|
self.bits.to_consensus().to_le_bytes().as_hex(),
|
||||||
self.nonce.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)
|
fmt::Display::fmt(&buf, f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -901,7 +901,7 @@ mod test {
|
||||||
let witness4: Witness = empty_data.iter().collect();
|
let witness4: Witness = empty_data.iter().collect();
|
||||||
assert!(witness4.is_empty());
|
assert!(witness4.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "hex")]
|
#[cfg(feature = "hex")]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_from_hex() {
|
fn test_from_hex() {
|
||||||
|
|
|
@ -7,8 +7,8 @@ use core::ops;
|
||||||
use NumOpResult as R;
|
use NumOpResult as R;
|
||||||
|
|
||||||
use super::{Amount, SignedAmount};
|
use super::{Amount, SignedAmount};
|
||||||
|
use crate::internal_macros::{impl_div_assign, impl_mul_assign};
|
||||||
use crate::{MathOp, NumOpError, NumOpResult, OptionExt};
|
use crate::{MathOp, NumOpError, NumOpResult, OptionExt};
|
||||||
use crate::internal_macros::{impl_mul_assign, impl_div_assign};
|
|
||||||
|
|
||||||
impl From<Amount> for NumOpResult<Amount> {
|
impl From<Amount> for NumOpResult<Amount> {
|
||||||
fn from(a: Amount) -> Self { Self::Valid(a) }
|
fn from(a: Amount) -> Self { Self::Valid(a) }
|
||||||
|
|
|
@ -24,14 +24,10 @@ fn sat(sat: u64) -> Amount { Amount::from_sat(sat).unwrap() }
|
||||||
fn ssat(ssat: i64) -> SignedAmount { SignedAmount::from_sat(ssat).unwrap() }
|
fn ssat(ssat: i64) -> SignedAmount { SignedAmount::from_sat(ssat).unwrap() }
|
||||||
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
fn res(n_sat: u64) -> NumOpResult<Amount>{
|
fn res(n_sat: u64) -> NumOpResult<Amount> { NumOpResult::from(sat(n_sat)) }
|
||||||
NumOpResult::from(sat(n_sat))
|
|
||||||
}
|
|
||||||
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
fn sres(n_sat: i64) -> NumOpResult<SignedAmount>{
|
fn sres(n_sat: i64) -> NumOpResult<SignedAmount> { NumOpResult::from(ssat(n_sat)) }
|
||||||
NumOpResult::from(ssat(n_sat))
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn sanity_check() {
|
fn sanity_check() {
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
//! Provides a monodic type returned by mathematical operations (`core::ops`).
|
//! Provides a monodic type returned by mathematical operations (`core::ops`).
|
||||||
|
|
||||||
use core::fmt;
|
|
||||||
use core::convert::Infallible;
|
use core::convert::Infallible;
|
||||||
|
use core::fmt;
|
||||||
|
|
||||||
use NumOpResult as R;
|
use NumOpResult as R;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue