Skip to content

Commit fa52a31

Browse files
committed
Merge rust-bitcoin#4527: Automated nightly rustfmt (2025-05-18)
d9ec934 2025-05-18 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 d9ec934 apoelstra: ACK d9ec934; successfully ran local tests Tree-SHA512: 9f1914af1375443e421ab5309ef8af0f64aa0b3dd03a4cde15b8315d1453f43f35533ae31a7295a83599e7e5ce081149c97f63bbab21e371d60b9401baecc941
2 parents 9310942 + d9ec934 commit fa52a31

File tree

8 files changed

+20
-19
lines changed

8 files changed

+20
-19
lines changed

bitcoin/src/blockdata/script/builder.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ impl Builder {
2323

2424
/// Constructs a new empty script builder with at least the specified capacity.
2525
#[inline]
26-
pub fn with_capacity(capacity: usize) -> Self { Builder(ScriptBuf::with_capacity(capacity), None) }
26+
pub fn with_capacity(capacity: usize) -> Self {
27+
Builder(ScriptBuf::with_capacity(capacity), None)
28+
}
2729

2830
/// Returns the length in bytes of the script.
2931
pub fn len(&self) -> usize { self.0.len() }

bitcoin/src/blockdata/transaction.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use hashes::sha256d;
1616
use internals::{compact_size, write_err, ToU64};
1717
use io::{BufRead, Write};
1818
use primitives::Sequence;
19+
use units::NumOpResult;
1920

2021
use super::Weight;
2122
use crate::consensus::{self, encode, Decodable, Encodable};
@@ -27,7 +28,6 @@ use crate::script::{Script, ScriptBuf, ScriptExt as _, ScriptExtPriv as _};
2728
use crate::sighash::{EcdsaSighashType, TapSighashType};
2829
use crate::witness::Witness;
2930
use crate::{Amount, FeeRate, SignedAmount};
30-
use units::NumOpResult;
3131

3232
#[rustfmt::skip] // Keep public re-exports separate.
3333
#[doc(inline)]
@@ -786,10 +786,7 @@ pub fn effective_value(
786786
) -> NumOpResult<SignedAmount> {
787787
let weight = input_weight_prediction.total_weight();
788788

789-
fee_rate
790-
.to_fee(weight)
791-
.map(Amount::to_signed)
792-
.and_then(|fee| value.to_signed() - fee) // Cannot overflow.
789+
fee_rate.to_fee(weight).map(Amount::to_signed).and_then(|fee| value.to_signed() - fee) // Cannot overflow.
793790
}
794791

795792
/// Predicts the weight of a to-be-constructed transaction.
@@ -1943,7 +1940,7 @@ mod tests {
19431940
// needless_borrows_for_generic_args incorrecctly identifies &[] as a needless borrow
19441941
#[allow(clippy::needless_borrows_for_generic_args)]
19451942
fn weight_prediction_new() {
1946-
let p2wpkh_max = InputWeightPrediction::new(0, [72,33]);
1943+
let p2wpkh_max = InputWeightPrediction::new(0, [72, 33]);
19471944
assert_eq!(p2wpkh_max.script_size, 1);
19481945
assert_eq!(p2wpkh_max.witness_size, 108);
19491946
assert_eq!(p2wpkh_max.total_weight(), Weight::from_wu(272));

bitcoin/src/p2p/address.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ impl fmt::Display for AddrV2ConversionError {
165165

166166
impl std::error::Error for AddrV2ConversionError {}
167167

168-
169168
impl From<SocketAddr> for AddrV2 {
170169
fn from(addr: SocketAddr) -> Self {
171170
match addr {

bitcoin/src/psbt/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -852,11 +852,11 @@ impl GetKey for $map<PublicKey, PrivateKey> {
852852
KeyRequest::XOnlyPubkey(xonly) => {
853853
let pubkey_even = xonly.public_key(secp256k1::Parity::Even);
854854
let key = self.get(&pubkey_even).cloned();
855-
855+
856856
if key.is_some() {
857857
return Ok(key);
858858
}
859-
859+
860860
let pubkey_odd = xonly.public_key(secp256k1::Parity::Odd);
861861
if let Some(priv_key) = self.get(&pubkey_odd).copied() {
862862
let negated_priv_key = priv_key.negate();
@@ -889,18 +889,18 @@ impl GetKey for $map<XOnlyPublicKey, PrivateKey> {
889889
KeyRequest::XOnlyPubkey(xonly) => Ok(self.get(xonly).cloned()),
890890
KeyRequest::Pubkey(pk) => {
891891
let (xonly, parity) = pk.inner.x_only_public_key();
892-
892+
893893
if let Some(mut priv_key) = self.get(&XOnlyPublicKey::from(xonly)).cloned() {
894894
let computed_pk = priv_key.public_key(&secp);
895895
let (_, computed_parity) = computed_pk.inner.x_only_public_key();
896-
896+
897897
if computed_parity != parity {
898898
priv_key = priv_key.negate();
899899
}
900-
900+
901901
return Ok(Some(priv_key));
902902
}
903-
903+
904904
Ok(None)
905905
},
906906
KeyRequest::Bip32(_) => Err(GetKeyError::NotSupported),

units/src/fee_rate/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ crate::internal_macros::impl_op_for_references! {
150150

151151
impl ops::Div<NonZeroU64> for FeeRate {
152152
type Output = FeeRate;
153-
153+
154154
fn div(self, rhs: NonZeroU64) -> Self::Output{ Self::from_sat_per_kwu(self.to_sat_per_kwu() / rhs.get()) }
155155
}
156156
}
@@ -191,9 +191,10 @@ impl<'a> Arbitrary<'a> for FeeRate {
191191

192192
#[cfg(test)]
193193
mod tests {
194-
use super::*;
195194
use core::num::NonZeroU64;
196195

196+
use super::*;
197+
197198
#[test]
198199
fn sanity_check() {
199200
let fee_rate: u64 = u64::from(FeeRate::from_sat_per_kwu(100));

units/src/result.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ pub enum NumOpResult<T> {
8888
}
8989

9090
impl<T> NumOpResult<T> {
91-
9291
/// Maps a `NumOpResult<T>` to `NumOpResult<U>` by applying a function to a
9392
/// contained [`NumOpResult::Valid`] value, leaving a [`NumOpResult::Error`] value untouched.
9493
///

units/src/weight.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,10 @@ impl<'a> Arbitrary<'a> for Weight {
293293

294294
#[cfg(test)]
295295
mod tests {
296-
use super::*;
297296
use core::num::NonZeroU64;
298297

298+
use super::*;
299+
299300
const ONE: Weight = Weight::from_wu(1);
300301
const TWO: Weight = Weight::from_wu(2);
301302
const FOUR: Weight = Weight::from_wu(4);

units/tests/serde.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
use bincode::serialize;
99
use bitcoin_units::locktime::{absolute, relative};
10-
use bitcoin_units::{amount, fee_rate, Amount, BlockHeight, BlockInterval, FeeRate, SignedAmount, Weight};
10+
use bitcoin_units::{
11+
amount, fee_rate, Amount, BlockHeight, BlockInterval, FeeRate, SignedAmount, Weight,
12+
};
1113
use serde::{Deserialize, Serialize};
1214

1315
/// A struct that includes all the types that implement or support `serde` traits.

0 commit comments

Comments
 (0)