Skip to content

Commit 6e66253

Browse files
committed
Merge rust-bitcoin#4555: Automated nightly rustfmt (2025-05-25)
c73131c 2025-05-25 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 c73131c; successfully ran local tests Tree-SHA512: 51995608b286cbccce0cf81e77c72ec6d25be91219e8e9bf34245a66a6f089b6bcd9d4313f1dc82068655010268dd33f586208cfe9ebbfaed6e517b1fc3a4c37
2 parents ecf4b2b + c73131c commit 6e66253

File tree

5 files changed

+18
-35
lines changed

5 files changed

+18
-35
lines changed

bitcoin/src/psbt/mod.rs

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -749,21 +749,19 @@ impl serde::Serialize for Psbt {
749749
impl<'de> serde::Deserialize<'de> for Psbt {
750750
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
751751
where
752-
D: serde::Deserializer<'de>
752+
D: serde::Deserializer<'de>,
753753
{
754754
struct Visitor;
755755

756-
impl<'de> serde::de::Visitor<'de> for Visitor
757-
{
756+
impl<'de> serde::de::Visitor<'de> for Visitor {
758757
type Value = Psbt;
759758

760759
fn expecting(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
761760
write!(f, "a psbt")
762761
}
763762

764763
fn visit_bytes<E: serde::de::Error>(self, bytes: &[u8]) -> Result<Self::Value, E> {
765-
Psbt::deserialize(bytes)
766-
.map_err(|e| serde::de::Error::custom(e))
764+
Psbt::deserialize(bytes).map_err(|e| serde::de::Error::custom(e))
767765
}
768766

769767
fn visit_str<E: serde::de::Error>(self, s: &str) -> Result<Self::Value, E> {
@@ -900,11 +898,11 @@ impl GetKey for $map<PublicKey, PrivateKey> {
900898
KeyRequest::XOnlyPubkey(xonly) => {
901899
let pubkey_even = xonly.public_key(secp256k1::Parity::Even);
902900
let key = self.get(&pubkey_even).cloned();
903-
901+
904902
if key.is_some() {
905903
return Ok(key);
906904
}
907-
905+
908906
let pubkey_odd = xonly.public_key(secp256k1::Parity::Odd);
909907
if let Some(priv_key) = self.get(&pubkey_odd).copied() {
910908
let negated_priv_key = priv_key.negate();
@@ -937,18 +935,18 @@ impl GetKey for $map<XOnlyPublicKey, PrivateKey> {
937935
KeyRequest::XOnlyPubkey(xonly) => Ok(self.get(xonly).cloned()),
938936
KeyRequest::Pubkey(pk) => {
939937
let (xonly, parity) = pk.inner.x_only_public_key();
940-
938+
941939
if let Some(mut priv_key) = self.get(&XOnlyPublicKey::from(xonly)).cloned() {
942940
let computed_pk = priv_key.public_key(&secp);
943941
let (_, computed_parity) = computed_pk.inner.x_only_public_key();
944-
942+
945943
if computed_parity != parity {
946944
priv_key = priv_key.negate();
947945
}
948-
946+
949947
return Ok(Some(priv_key));
950948
}
951-
949+
952950
Ok(None)
953951
},
954952
KeyRequest::Bip32(_) => Err(GetKeyError::NotSupported),
@@ -1456,17 +1454,15 @@ mod tests {
14561454
Err(ABSURD_FEE_RATE)
14571455
);
14581456
assert_eq!(
1459-
psbt.clone()
1460-
.extract_tx_with_fee_rate_limit(JUST_BELOW_ABSURD_FEE_RATE)
1461-
.map_err(|e| match e {
1457+
psbt.clone().extract_tx_with_fee_rate_limit(JUST_BELOW_ABSURD_FEE_RATE).map_err(|e| {
1458+
match e {
14621459
ExtractTxError::AbsurdFeeRate { fee_rate, .. } => fee_rate,
14631460
_ => panic!(""),
1464-
}),
1461+
}
1462+
}),
14651463
Err(ABSURD_FEE_RATE)
14661464
);
1467-
assert!(psbt
1468-
.extract_tx_with_fee_rate_limit(ABSURD_FEE_RATE)
1469-
.is_ok());
1465+
assert!(psbt.extract_tx_with_fee_rate_limit(ABSURD_FEE_RATE).is_ok());
14701466

14711467
// Testing that extract_tx will error at 25k sat/vbyte (6250000 sat/kwu)
14721468
assert_eq!(

bitcoin/tests/serde.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ use bitcoin::consensus::encode::deserialize;
3030
use bitcoin::hashes::{hash160, ripemd160, sha256, sha256d};
3131
use bitcoin::hex::FromHex;
3232
use bitcoin::locktime::{absolute, relative};
33-
use bitcoin::psbt::raw;
34-
use bitcoin::psbt::{Input, Output, Psbt, PsbtSighashType};
33+
use bitcoin::psbt::{raw, Input, Output, Psbt, PsbtSighashType};
3534
use bitcoin::script::ScriptBufExt as _;
3635
use bitcoin::sighash::{EcdsaSighashType, TapSighashType};
3736
use bitcoin::taproot::{self, ControlBlock, LeafVersion, TapTree, TaprootBuilder};

fuzz/fuzz_targets/bitcoin/p2p_address_roundtrip.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,17 @@ fn do_test(data: &[u8]) {
1919

2020
if let Ok(ip_addr) = IpAddr::try_from(addr_v2.clone()) {
2121
let round_trip: AddrV2 = AddrV2::from(ip_addr);
22-
assert_eq!(
23-
addr_v2, round_trip,
24-
"AddrV2 -> IpAddr -> AddrV2 should round-trip correctly"
25-
);
22+
assert_eq!(addr_v2, round_trip, "AddrV2 -> IpAddr -> AddrV2 should round-trip correctly");
2623
}
2724

2825
if let Ok(ip_addr) = Ipv4Addr::try_from(addr_v2.clone()) {
2926
let round_trip: AddrV2 = AddrV2::from(ip_addr);
30-
assert_eq!(
31-
addr_v2, round_trip,
32-
"AddrV2 -> Ipv4Addr -> AddrV2 should round-trip correctly"
33-
);
27+
assert_eq!(addr_v2, round_trip, "AddrV2 -> Ipv4Addr -> AddrV2 should round-trip correctly");
3428
}
3529

3630
if let Ok(ip_addr) = Ipv6Addr::try_from(addr_v2.clone()) {
3731
let round_trip: AddrV2 = AddrV2::from(ip_addr);
38-
assert_eq!(
39-
addr_v2, round_trip,
40-
"AddrV2 -> Ipv6Addr -> AddrV2 should round-trip correctly"
41-
);
32+
assert_eq!(addr_v2, round_trip, "AddrV2 -> Ipv6Addr -> AddrV2 should round-trip correctly");
4233
}
4334

4435
if let Ok(socket_addr) = SocketAddr::try_from(addr_v2.clone()) {

units/src/amount/error.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,6 @@ impl fmt::Display for ParseDenominationError {
347347
#[cfg(feature = "std")]
348348
impl std::error::Error for ParseDenominationError {
349349
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
350-
351350
match *self {
352351
Self::Unknown(_) | Self::PossiblyConfusing(_) => None,
353352
}

units/src/locktime/absolute.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,6 @@ impl ParseError {
377377
) -> fmt::Result {
378378
use core::num::IntErrorKind;
379379

380-
381380
match self {
382381
Self::ParseInt(ParseIntError { input, bits: _, is_signed: _, source })
383382
if *source.kind() == IntErrorKind::PosOverflow =>
@@ -425,7 +424,6 @@ impl ParseError {
425424
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
426425
use core::num::IntErrorKind;
427426

428-
429427
match self {
430428
Self::ParseInt(ParseIntError { source, .. })
431429
if *source.kind() == IntErrorKind::PosOverflow =>

0 commit comments

Comments
 (0)