Merge rust-bitcoin/rust-bitcoin#6949: Manual nightly rustfmt (2026-09-27)
What changed, and why it matters
This commit is purely a code formatting cleanup. It adjusts whitespace, line breaks, import order, and adds a single #[rustfmt::skip] annotation so an automated formatter does not reformat a test data array. There are no functional code changes and no security implications.
No action required. This is a style-only change; routine review/CI pass is sufficient.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The merge commit applies rustfmt (nightly 2026-09-27) across nine files. All changes are cosmetic: indentation fixes, re-wrapped expressions, reordered imports, and removal of blank lines. The only non-formatting directive is #[rustfmt::skip] in primitives/tests/encoding.rs to preserve a manually aligned byte array. No logic, API, or behavior changes are present.
Changed components
Inspect captured patch +50 / −33
### addresses/src/lib.rs
@@ -1310,7 +1310,7 @@ mod tests {
assert!(a1.matches_script_pubkey(&a1.script_pubkey()));
assert!(!a0.matches_script_pubkey(&a1.script_pubkey()));
assert!(!a1.matches_script_pubkey(&a0.script_pubkey()));
-}
+ }
#[test]
fn address_debug() {
### internals/src/array_vec.rs
@@ -97,7 +97,8 @@ impl<T: Copy, const CAP: usize> ArrayVec<T, CAP> {
///
/// Returns error if the `ArrayVec` is full.
pub fn try_push(&mut self, element: T) -> Result<(), CapacityExceededError> {
- let first = self.spare_capacity_mut().first_mut().ok_or(CapacityExceededError { capacity: CAP })?;
+ let first =
+ self.spare_capacity_mut().first_mut().ok_or(CapacityExceededError { capacity: CAP })?;
*first = MaybeUninit::new(element);
let old_len = self.len();
// SOUNDNESS:
### p2p/src/message.rs
@@ -2850,9 +2850,7 @@ mod test {
FeeFilter(FeeRate::ZERO)
);
let bytes = max_money.to_le_bytes();
- let max_feerate = FeeFilter(
- FeeRate::from_sat_per_kvb(Amount::MAX_MONEY.to_sat()).unwrap(),
- );
+ let max_feerate = FeeFilter(FeeRate::from_sat_per_kvb(Amount::MAX_MONEY.to_sat()).unwrap());
assert_eq!(encoding::decode_from_slice::<FeeFilter>(&bytes).unwrap(), max_feerate);
// Invalid cases
### primitives/src/transaction.rs
@@ -68,8 +68,8 @@ use encoding::FromHexError;
use encoding::{ArrayEncoder, BytesEncoder, Encoder2};
#[cfg(feature = "alloc")]
use encoding::{
- Decoder2, Decoder3, DecoderStatus, Encode as _, Encoder3, Encoder6,
- IterEncoder, PrefixedSliceEncoder, VecDecoder,
+ Decoder2, Decoder3, DecoderStatus, Encode as _, Encoder3, Encoder6, IterEncoder,
+ PrefixedSliceEncoder, VecDecoder,
};
#[cfg(feature = "alloc")]
use hashes::sha256d;
### primitives/tests/encoding.rs
@@ -193,6 +193,7 @@ fn encode_block() {
};
let block = Block::new_unchecked(header, vec![tx]);
+ #[rustfmt::skip]
let expected = concat_slices!(
// The block version.
&[2u8, 0, 0, 0],
### units/src/amount/ops.rs
@@ -316,7 +316,8 @@ impl core::iter::Sum<Self> for NumOpResult<Amount> {
where
I: Iterator<Item = Self>,
{
- let result = iter.try_fold(Amount::ZERO, |acc, amount| (acc + amount.into_result()?).into_result());
+ let result =
+ iter.try_fold(Amount::ZERO, |acc, amount| (acc + amount.into_result()?).into_result());
Self::from_result(result)
}
}
@@ -326,7 +327,8 @@ impl<'a> core::iter::Sum<&'a Self> for NumOpResult<Amount> {
where
I: Iterator<Item = &'a Self>,
{
- let result = iter.try_fold(Amount::ZERO, |acc, amount| (acc + amount.into_result()?).into_result());
+ let result =
+ iter.try_fold(Amount::ZERO, |acc, amount| (acc + amount.into_result()?).into_result());
Self::from_result(result)
}
}
@@ -359,7 +361,9 @@ impl core::iter::Sum<Self> for NumOpResult<SignedAmount> {
where
I: Iterator<Item = Self>,
{
- let result = iter.try_fold(SignedAmount::ZERO, |acc, amount| (acc + amount.into_result()?).into_result());
+ let result = iter.try_fold(SignedAmount::ZERO, |acc, amount| {
+ (acc + amount.into_result()?).into_result()
+ });
Self::from_result(result)
}
}
@@ -370,7 +374,9 @@ impl<'a> core::iter::Sum<&'a Self> for NumOpResult<SignedAmount> {
where
I: Iterator<Item = &'a Self>,
{
- let result = iter.try_fold(SignedAmount::ZERO, |acc, amount| (acc + amount.into_result()?).into_result());
+ let result = iter.try_fold(SignedAmount::ZERO, |acc, amount| {
+ (acc + amount.into_result()?).into_result()
+ });
Self::from_result(result)
}
}
### units/src/amount/serde.rs
@@ -63,13 +63,12 @@ pub mod as_sat {
use core::fmt;
use core::marker::PhantomData;
+
use serde::{Deserializer, Serialize, Serializer};
use crate::SignedAmount;
- fn is_signed<T: TryFrom<SignedAmount>>() -> bool {
- T::try_from(-SignedAmount::ONE_SAT).is_ok()
- }
+ fn is_signed<T: TryFrom<SignedAmount>>() -> bool { T::try_from(-SignedAmount::ONE_SAT).is_ok() }
#[test]
fn is_signed_correct() {
@@ -107,7 +106,10 @@ pub mod as_sat {
// We use custom visitor to have better control over error messages
struct Visitor<T>(PhantomData<fn() -> T>);
- impl<'de, T> serde::de::Visitor<'de> for Visitor<T> where T: TryFrom<SignedAmount> {
+ impl<'de, T> serde::de::Visitor<'de> for Visitor<T>
+ where
+ T: TryFrom<SignedAmount>,
+ {
type Value = T;
fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -116,7 +118,8 @@ pub mod as_sat {
fn visit_i64<E: serde::de::Error>(self, value: i64) -> Result<Self::Value, E> {
fn range_error<T, E1, E2: serde::de::Error>(value: i64) -> impl FnOnce(E1) -> E2
- where T: TryFrom<SignedAmount>
+ where
+ T: TryFrom<SignedAmount>,
{
move |_| {
let unexpected = serde::de::Unexpected::Signed(value);
@@ -132,7 +135,8 @@ pub mod as_sat {
fn visit_u64<E: serde::de::Error>(self, value: u64) -> Result<Self::Value, E> {
fn range_error<T, E1, E2: serde::de::Error>(value: u64) -> impl FnOnce(E1) -> E2
- where T: TryFrom<SignedAmount>
+ where
+ T: TryFrom<SignedAmount>,
{
move |_| {
let unexpected = serde::de::Unexpected::Unsigned(value);
@@ -163,9 +167,9 @@ pub mod as_sat {
use core::fmt;
use core::marker::PhantomData;
- use super::is_signed;
use serde::{de, Deserializer, Serialize, Serializer};
+ use super::is_signed;
use crate::SignedAmount;
#[inline]
@@ -241,11 +245,11 @@ pub mod as_sat {
use alloc::vec::Vec;
use core::fmt;
use core::marker::PhantomData;
- use super::is_signed;
use serde::de::{self, SeqAccess};
use serde::{Deserialize, Deserializer, Serializer};
+ use super::is_signed;
use crate::SignedAmount;
#[inline]
@@ -293,7 +297,9 @@ pub mod as_sat {
{
#[derive(Deserialize)]
#[serde(transparent)]
- struct Wrapper<T: TryFrom<SignedAmount>>(#[serde(with = "super")] T) where T::Error: core::fmt::Display;
+ struct Wrapper<T: TryFrom<SignedAmount>>(#[serde(with = "super")] T)
+ where
+ T::Error: core::fmt::Display;
let mut out = Vec::with_capacity(internals::serde::cautious_size_hint::<X>(
seq.size_hint(),
### units/src/fee_rate/mod.rs
@@ -65,7 +65,10 @@ impl FeeRate {
// No `map()` in const context.
match sat_kwu.checked_mul(4_000) {
Some(fee_rate) => R::Valid(Self::from_sat_per_mvb(fee_rate)),
- None => R::Error(E::while_doing(MathErrorKind::Overflow { op: MathOp::Mul, is_negative: false })),
+ None => R::Error(E::while_doing(MathErrorKind::Overflow {
+ op: MathOp::Mul,
+ is_negative: false,
+ })),
}
}
@@ -88,7 +91,10 @@ impl FeeRate {
// No `map()` in const context.
match sat_vb.checked_mul(1_000_000) {
Some(fee_rate) => R::Valid(Self::from_sat_per_mvb(fee_rate)),
- None => R::Error(E::while_doing(MathErrorKind::Overflow { op: MathOp::Mul, is_negative: false })),
+ None => R::Error(E::while_doing(MathErrorKind::Overflow {
+ op: MathOp::Mul,
+ is_negative: false,
+ })),
}
}
@@ -118,7 +124,10 @@ impl FeeRate {
// No `map()` in const context.
match sat_kvb.checked_mul(1_000) {
Some(fee_rate) => R::Valid(Self::from_sat_per_mvb(fee_rate)),
- None => R::Error(E::while_doing(MathErrorKind::Overflow { op: MathOp::Mul, is_negative: false })),
+ None => R::Error(E::while_doing(MathErrorKind::Overflow {
+ op: MathOp::Mul,
+ is_negative: false,
+ })),
}
}
@@ -319,7 +328,6 @@ mod tests {
#[test]
#[allow(clippy::op_ref)]
fn feerate_div_nonzero() {
-
let rate = FeeRate::from_sat_per_kwu_u32(200);
let divisor = NonZeroU64::new(2).unwrap();
assert_eq!(rate / divisor, ONE_HUNDRED);
@@ -492,8 +500,7 @@ mod tests {
#[test]
fn checked_div() {
- let fee_rate =
- TEN.checked_div(10).expect("expected feerate in sat/kwu");
+ let fee_rate = TEN.checked_div(10).expect("expected feerate in sat/kwu");
assert_eq!(fee_rate, ONE);
let fee_rate = TEN.checked_div(0);
### units/src/fee_rate/serde.rs
@@ -45,13 +45,11 @@ pub mod as_sat_per_kwu_floor {
use crate::serde::de::Error;
let sat_per_kwu = u64::deserialize(d)?;
- FeeRate::from_sat_per_kwu(sat_per_kwu)
- .into_result()
- .map_err(|_| {
- let unexpected = serde::de::Unexpected::Unsigned(sat_per_kwu);
- let expected = &"non-negative integer up to 4611686018427387";
- D::Error::invalid_value(unexpected, expected)
- })
+ FeeRate::from_sat_per_kwu(sat_per_kwu).into_result().map_err(|_| {
+ let unexpected = serde::de::Unexpected::Unsigned(sat_per_kwu);
+ let expected = &"non-negative integer up to 4611686018427387";
+ D::Error::invalid_value(unexpected, expected)
+ })
}
pub mod opt {Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.