Skip to content

Commit cfccd38

Browse files
committed
Merge rust-bitcoin#4242: Automated nightly rustfmt (2025-03-16)
a74e08a 2025-03-16 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: tcharding: ACK a74e08a apoelstra: ACK a74e08a; successfully ran local tests Tree-SHA512: ca233e517c6734181e86940ba92bde1c2b138b66ff27e80a10f98d5ae1aac5ac73ec46633bba2a94ba143d01602764bfe6ffad2378cdf8bbfe4210be620113ea
2 parents 78538bc + a74e08a commit cfccd38

File tree

24 files changed

+87
-91
lines changed

24 files changed

+87
-91
lines changed

bitcoin/src/bip152.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ mod test {
413413
use crate::merkle_tree::TxMerkleNode;
414414
use crate::transaction::OutPointExt;
415415
use crate::{
416-
transaction, Amount, BlockChecked, CompactTarget, OutPoint, ScriptBuf, Sequence, BlockTime,
416+
transaction, Amount, BlockChecked, BlockTime, CompactTarget, OutPoint, ScriptBuf, Sequence,
417417
TxIn, TxOut, Txid, Witness,
418418
};
419419

bitcoin/src/blockdata/constants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::opcodes::all::*;
1616
use crate::pow::CompactTarget;
1717
use crate::transaction::{self, OutPoint, Transaction, TxIn, TxOut};
1818
use crate::witness::Witness;
19-
use crate::{script, Amount, BlockHash, Sequence, TestnetVersion, BlockTime};
19+
use crate::{script, Amount, BlockHash, BlockTime, Sequence, TestnetVersion};
2020

2121
/// How many seconds between blocks we expect on average.
2222
pub const TARGET_BLOCK_SPACING: u32 = 600;

bitcoin/src/blockdata/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ pub use self::{
2121

2222
/// Implements `FeeRate` and assoctiated features.
2323
pub mod fee_rate {
24-
/// Re-export everything from the [`units::fee_rate`] module.
25-
pub use units::fee_rate::FeeRate;
2624
#[cfg(feature = "serde")]
2725
pub use units::fee_rate::serde;
26+
/// Re-export everything from the [`units::fee_rate`] module.
27+
pub use units::fee_rate::FeeRate;
2828
}
2929

3030
/// Provides absolute and relative locktimes.

bitcoin/src/blockdata/script/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::address::script_pubkey::{
88
};
99
use crate::consensus::encode::{deserialize, serialize};
1010
use crate::crypto::key::{PublicKey, XOnlyPublicKey};
11-
use crate::{Amount, FeeRate, opcodes};
11+
use crate::{opcodes, Amount, FeeRate};
1212

1313
#[test]
1414
#[rustfmt::skip]

bitcoin/src/crypto/key.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ impl PrivateKey {
462462
/// Deserializes a private key from a byte array.
463463
pub fn from_byte_array(
464464
data: [u8; 32],
465-
network: impl Into<NetworkKind>
465+
network: impl Into<NetworkKind>,
466466
) -> Result<PrivateKey, secp256k1::Error> {
467467
Ok(PrivateKey::new(secp256k1::SecretKey::from_byte_array(&data)?, network))
468468
}

bitcoin/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,7 @@ pub use crate::{
164164
blockdata::script::witness_program::{self, WitnessProgram},
165165
blockdata::script::witness_version::{self, WitnessVersion},
166166
// These modules also re-export all the respective `primitives` types.
167-
blockdata::{
168-
block, constants, fee_rate, locktime, script, transaction, weight, witness,
169-
},
167+
blockdata::{block, constants, fee_rate, locktime, script, transaction, weight, witness},
170168
};
171169

172170
#[rustfmt::skip]

bitcoin/src/psbt/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl Psbt {
135135
/// An alias for [`extract_tx_fee_rate_limit`].
136136
///
137137
/// [`extract_tx_fee_rate_limit`]: Psbt::extract_tx_fee_rate_limit
138-
#[allow(clippy::result_large_err)] // The PSBT returned in `SendingToomuch` is large.
138+
#[allow(clippy::result_large_err)] // The PSBT returned in `SendingToomuch` is large.
139139
pub fn extract_tx(self) -> Result<Transaction, ExtractTxError> {
140140
self.internal_extract_tx_with_fee_rate_limit(Self::DEFAULT_MAX_FEE_RATE)
141141
}
@@ -147,7 +147,7 @@ impl Psbt {
147147
/// [`ExtractTxError`] variants will contain either the [`Psbt`] itself or the [`Transaction`]
148148
/// that was extracted. These can be extracted from the Errors in order to recover.
149149
/// See the error documentation for info on the variants. In general, it covers large fees.
150-
#[allow(clippy::result_large_err)] // The PSBT returned in `SendingToomuch` is large.
150+
#[allow(clippy::result_large_err)] // The PSBT returned in `SendingToomuch` is large.
151151
pub fn extract_tx_fee_rate_limit(self) -> Result<Transaction, ExtractTxError> {
152152
self.internal_extract_tx_with_fee_rate_limit(Self::DEFAULT_MAX_FEE_RATE)
153153
}
@@ -159,7 +159,7 @@ impl Psbt {
159159
/// See [`extract_tx`].
160160
///
161161
/// [`extract_tx`]: Psbt::extract_tx
162-
#[allow(clippy::result_large_err)] // The PSBT returned in `SendingToomuch` is large.
162+
#[allow(clippy::result_large_err)] // The PSBT returned in `SendingToomuch` is large.
163163
pub fn extract_tx_with_fee_rate_limit(
164164
self,
165165
max_fee_rate: FeeRate,
@@ -187,7 +187,7 @@ impl Psbt {
187187
}
188188

189189
#[inline]
190-
#[allow(clippy::result_large_err)] // The PSBT returned in `SendingToomuch` is large.
190+
#[allow(clippy::result_large_err)] // The PSBT returned in `SendingToomuch` is large.
191191
fn internal_extract_tx_with_fee_rate_limit(
192192
self,
193193
max_fee_rate: FeeRate,

bitcoin/src/psbt/serialize.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,8 @@ impl Serialize for XOnlyPublicKey {
260260

261261
impl Deserialize for XOnlyPublicKey {
262262
fn deserialize(bytes: &[u8]) -> Result<Self, Error> {
263-
XOnlyPublicKey::from_byte_array(
264-
bytes.try_into().map_err(|_| Error::InvalidXOnlyPublicKey)?,
265-
)
266-
.map_err(|_| Error::InvalidXOnlyPublicKey)
263+
XOnlyPublicKey::from_byte_array(bytes.try_into().map_err(|_| Error::InvalidXOnlyPublicKey)?)
264+
.map_err(|_| Error::InvalidXOnlyPublicKey)
267265
}
268266
}
269267

bitcoin/src/taproot/merkle_branch.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ impl TaprootMerkleBranch {
5252
} else if node_hashes.len() > TAPROOT_CONTROL_MAX_NODE_COUNT {
5353
Err(InvalidMerkleTreeDepthError(sl.len() / TAPROOT_CONTROL_NODE_SIZE).into())
5454
} else {
55-
let inner = node_hashes
56-
.iter()
57-
.copied()
58-
.map(TapNodeHash::from_byte_array)
59-
.collect();
55+
let inner = node_hashes.iter().copied().map(TapNodeHash::from_byte_array).collect();
6056

6157
Ok(TaprootMerkleBranch(inner))
6258
}

bitcoin/tests/serde.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ fn serde_regression_txin() {
109109

110110
#[test]
111111
fn serde_regression_txout() {
112-
let txout =
113-
TxOut { value: Amount::MAX, script_pubkey: ScriptBuf::from(vec![0u8, 1u8, 2u8]) };
112+
let txout = TxOut { value: Amount::MAX, script_pubkey: ScriptBuf::from(vec![0u8, 1u8, 2u8]) };
114113
let got = serialize(&txout).unwrap();
115114
let want = include_bytes!("data/serde/txout_bincode") as &[_];
116115
assert_eq!(got, want)

0 commit comments

Comments
 (0)