Skip to content

Commit c9c0c0c

Browse files
committed
Merge rust-bitcoin#4945: Automated nightly rustfmt (2025-09-07)
975552c 2025-09-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 975552c; successfully ran local tests tcharding: ACK 975552c Tree-SHA512: 72c5fe4259d6923ec119cd665f491aa827fdb969a526b1b97f2a7bdbbeb7f88f3bf6244eab01ffb34e1ee25ef6cf2dd8176c9ab456f063f981e1c8cd6f2b4fa5
2 parents ba11d50 + 975552c commit c9c0c0c

File tree

11 files changed

+50
-56
lines changed

11 files changed

+50
-56
lines changed

bitcoin/src/blockdata/transaction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,9 +1250,9 @@ mod tests {
12501250
use super::*;
12511251
use crate::consensus::encode::{deserialize, serialize};
12521252
use crate::constants::WITNESS_SCALE_FACTOR;
1253+
use crate::parse_int;
12531254
use crate::script::ScriptSigBuf;
12541255
use crate::sighash::EcdsaSighashType;
1255-
use crate::parse_int;
12561256

12571257
const SOME_TX: &str = "0100000001a15d57094aa7a21a28cb20b59aab8fc7d1149a3bdbcddba9c622e4f5f6a99ece010000006c493046022100f93bb0e7d8db7bd46e40132d1f8242026e045f03a0efe71bbb8e3f475e970d790221009337cd7f1f929f00cc6ff01f03729b069a7c21b59b1736ddfee5db5946c5da8c0121033b9b137ee87d5a812d6f506efdd37f0affa7ffc310711c06c7f3e097c9447c52ffffffff0100e1f505000000001976a9140389035a9225b3839e2bbf32d826a1e222031fd888ac00000000";
12581258

bitcoin/src/crypto/sighash.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2097,7 +2097,6 @@ mod tests {
20972097
),
20982098
).unwrap();
20992099

2100-
21012100
let spk = ScriptPubKeyBuf::from_hex_no_length_prefix(
21022101
"00141d0f172a0ecb48aee1be1f2687d2963ae33f71a1",
21032102
)

bitcoin/src/psbt/mod.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,13 +530,18 @@ impl Psbt {
530530
Ok((Message::from(sighash), hash_ty))
531531
}
532532
Wpkh => {
533-
let sighash = cache.p2wpkh_signature_hash(input_index, spk, utxo.amount, hash_ty)?;
533+
let sighash =
534+
cache.p2wpkh_signature_hash(input_index, spk, utxo.amount, hash_ty)?;
534535
Ok((Message::from(sighash), hash_ty))
535536
}
536537
ShWpkh => {
537538
let redeem_script = input.redeem_script.as_ref().expect("checked above");
538-
let sighash =
539-
cache.p2wpkh_signature_hash(input_index, redeem_script, utxo.amount, hash_ty)?;
539+
let sighash = cache.p2wpkh_signature_hash(
540+
input_index,
541+
redeem_script,
542+
utxo.amount,
543+
hash_ty,
544+
)?;
540545
Ok((Message::from(sighash), hash_ty))
541546
}
542547
Wsh | ShWsh => {

consensus_encoding/src/encode/encoders.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,9 @@ impl<'sl> BytesEncoder<'sl> {
2626
}
2727

2828
impl<'e, 'sl> Encoder<'e> for BytesEncoder<'sl> {
29-
fn current_chunk(&self) -> Option<&[u8]> {
30-
self.sl
31-
}
29+
fn current_chunk(&self) -> Option<&[u8]> { self.sl }
3230

33-
fn advance(&mut self)-> bool {
31+
fn advance(&mut self) -> bool {
3432
self.sl = None;
3533
false
3634
}
@@ -47,12 +45,9 @@ impl<const N: usize> ArrayEncoder<N> {
4745
}
4846

4947
impl<'e, const N: usize> Encoder<'e> for ArrayEncoder<N> {
50-
fn current_chunk(&self) -> Option<&[u8]> {
51-
self.arr.as_ref().map(|x| &x[..])
52-
}
53-
48+
fn current_chunk(&self) -> Option<&[u8]> { self.arr.as_ref().map(|x| &x[..]) }
5449

55-
fn advance(&mut self)-> bool {
50+
fn advance(&mut self) -> bool {
5651
self.arr = None;
5752
false
5853
}
@@ -125,7 +120,9 @@ impl<A, B, C, D> Encoder4<A, B, C, D> {
125120
}
126121
}
127122

128-
impl<'e, A: Encoder<'e>, B: Encoder<'e>, C: Encoder<'e>, D: Encoder<'e>> Encoder<'e> for Encoder4<A, B, C, D> {
123+
impl<'e, A: Encoder<'e>, B: Encoder<'e>, C: Encoder<'e>, D: Encoder<'e>> Encoder<'e>
124+
for Encoder4<A, B, C, D>
125+
{
129126
fn current_chunk(&self) -> Option<&[u8]> { self.inner.current_chunk() }
130127
fn advance(&mut self) -> bool { self.inner.advance() }
131128
}
@@ -147,8 +144,15 @@ impl<A, B, C, D, E, F> Encoder6<A, B, C, D, E, F> {
147144
}
148145
}
149146

150-
impl<'e, A: Encoder<'e>, B: Encoder<'e>, C: Encoder<'e>, D: Encoder<'e>, E: Encoder<'e>, F: Encoder<'e>> Encoder<'e>
151-
for Encoder6<A, B, C, D, E, F>
147+
impl<
148+
'e,
149+
A: Encoder<'e>,
150+
B: Encoder<'e>,
151+
C: Encoder<'e>,
152+
D: Encoder<'e>,
153+
E: Encoder<'e>,
154+
F: Encoder<'e>,
155+
> Encoder<'e> for Encoder6<A, B, C, D, E, F>
152156
{
153157
fn current_chunk(&self) -> Option<&[u8]> { self.inner.current_chunk() }
154158
fn advance(&mut self) -> bool { self.inner.advance() }

consensus_encoding/src/encode/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ pub mod encoders;
1212
pub trait Encodable {
1313
/// The encoder associated with this type. Conceptually, the encoder is like
1414
/// an iterator which yields byte slices.
15-
type Encoder<'s>: Encoder<'s> where Self: 's;
15+
type Encoder<'s>: Encoder<'s>
16+
where
17+
Self: 's;
1618

1719
/// Constructs a "default encoder" for the type.
1820
fn encoder(&self) -> Self::Encoder<'_>;

primitives/src/block.rs

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ use hashes::{sha256d, HashEngine as _};
1818

1919
#[cfg(feature = "alloc")]
2020
use crate::prelude::Vec;
21+
use crate::{BlockTime, CompactTarget, TxMerkleNode};
2122
#[cfg(feature = "alloc")]
2223
use crate::{Transaction, WitnessMerkleNode};
23-
use crate::{BlockTime, CompactTarget, TxMerkleNode};
2424

2525
#[rustfmt::skip] // Keep public re-exports separate.
2626
#[doc(inline)]
@@ -255,16 +255,14 @@ impl Encodable for Header {
255255
type Encoder<'e> = HeaderEncoder;
256256

257257
fn encoder(&self) -> Self::Encoder<'_> {
258-
HeaderEncoder(
259-
encoding::Encoder6::new(
260-
self.version.encoder(),
261-
self.prev_blockhash.encoder(),
262-
self.merkle_root.encoder(),
263-
self.time.encoder(),
264-
self.bits.encoder(),
265-
encoding::ArrayEncoder::without_length_prefix(self.nonce.to_le_bytes()),
266-
)
267-
)
258+
HeaderEncoder(encoding::Encoder6::new(
259+
self.version.encoder(),
260+
self.prev_blockhash.encoder(),
261+
self.merkle_root.encoder(),
262+
self.time.encoder(),
263+
self.bits.encoder(),
264+
encoding::ArrayEncoder::without_length_prefix(self.nonce.to_le_bytes()),
265+
))
268266
}
269267
}
270268

@@ -365,9 +363,9 @@ encoding::encoder_newtype! {
365363
impl Encodable for Version {
366364
type Encoder<'e> = VersionEncoder;
367365
fn encoder(&self) -> Self::Encoder<'_> {
368-
VersionEncoder(
369-
encoding::ArrayEncoder::without_length_prefix(self.to_consensus().to_le_bytes())
370-
)
366+
VersionEncoder(encoding::ArrayEncoder::without_length_prefix(
367+
self.to_consensus().to_le_bytes(),
368+
))
371369
}
372370
}
373371

@@ -391,9 +389,7 @@ encoding::encoder_newtype! {
391389
impl Encodable for BlockHash {
392390
type Encoder<'e> = BlockHashEncoder;
393391
fn encoder(&self) -> Self::Encoder<'_> {
394-
BlockHashEncoder(
395-
encoding::ArrayEncoder::without_length_prefix(self.to_byte_array())
396-
)
392+
BlockHashEncoder(encoding::ArrayEncoder::without_length_prefix(self.to_byte_array()))
397393
}
398394
}
399395

primitives/src/merkle_tree.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ encoding::encoder_newtype! {
2828
impl encoding::Encodable for TxMerkleNode {
2929
type Encoder<'e> = TxMerkleNodeEncoder;
3030
fn encoder(&self) -> Self::Encoder<'_> {
31-
TxMerkleNodeEncoder(
32-
encoding::ArrayEncoder::without_length_prefix(self.to_byte_array())
33-
)
31+
TxMerkleNodeEncoder(encoding::ArrayEncoder::without_length_prefix(self.to_byte_array()))
3432
}
3533
}
3634

primitives/src/pow.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ encoding::encoder_newtype! {
5656
impl encoding::Encodable for CompactTarget {
5757
type Encoder<'e> = CompactTargetEncoder;
5858
fn encoder(&self) -> Self::Encoder<'_> {
59-
CompactTargetEncoder(
60-
encoding::ArrayEncoder::without_length_prefix(self.to_consensus().to_le_bytes())
61-
)
59+
CompactTargetEncoder(encoding::ArrayEncoder::without_length_prefix(
60+
self.to_consensus().to_le_bytes(),
61+
))
6262
}
6363
}
6464

units/src/fee_rate/mod.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,25 +106,19 @@ impl FeeRate {
106106
pub const fn to_sat_per_kwu_floor(self) -> u64 { self.to_sat_per_mvb() / 4_000 }
107107

108108
/// Converts to sat/kwu rounding up.
109-
pub const fn to_sat_per_kwu_ceil(self) -> u64 {
110-
self.to_sat_per_mvb().div_ceil(4_000)
111-
}
109+
pub const fn to_sat_per_kwu_ceil(self) -> u64 { self.to_sat_per_mvb().div_ceil(4_000) }
112110

113111
/// Converts to sat/vB rounding down.
114112
pub const fn to_sat_per_vb_floor(self) -> u64 { self.to_sat_per_mvb() / 1_000_000 }
115113

116114
/// Converts to sat/vB rounding up.
117-
pub const fn to_sat_per_vb_ceil(self) -> u64 {
118-
self.to_sat_per_mvb().div_ceil(1_000_000)
119-
}
115+
pub const fn to_sat_per_vb_ceil(self) -> u64 { self.to_sat_per_mvb().div_ceil(1_000_000) }
120116

121117
/// Converts to sat/kvb rounding down.
122118
pub const fn to_sat_per_kvb_floor(self) -> u64 { self.to_sat_per_mvb() / 1_000 }
123119

124120
/// Converts to sat/kvb rounding up.
125-
pub const fn to_sat_per_kvb_ceil(self) -> u64 {
126-
self.to_sat_per_mvb().div_ceil(1_000)
127-
}
121+
pub const fn to_sat_per_kvb_ceil(self) -> u64 { self.to_sat_per_mvb().div_ceil(1_000) }
128122

129123
/// Checked multiplication.
130124
///

units/src/time.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ encoding::encoder_newtype! {
8383
impl encoding::Encodable for BlockTime {
8484
type Encoder<'e> = BlockTimeEncoder;
8585
fn encoder(&self) -> Self::Encoder<'_> {
86-
BlockTimeEncoder(
87-
encoding::ArrayEncoder::without_length_prefix(self.to_u32().to_le_bytes())
88-
)
86+
BlockTimeEncoder(encoding::ArrayEncoder::without_length_prefix(self.to_u32().to_le_bytes()))
8987
}
9088
}
9189

0 commit comments

Comments
 (0)