Merge rust-bitcoin/rust-bitcoin#6878: Automated nightly rustfmt (2026-09-13)
What changed, and why it matters
This commit is an automated code-formatting run by a bot. It only changes whitespace, line breaks, and brace placement in four source files. No program logic, math, or security behavior was altered.
No security action needed. Treat as routine formatting maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff consists entirely of rustfmt reformatting: chained method calls broken across lines, if/else expressions collapsed to single-line form, match arms reformatted, and long let statements wrapped. There are no semantic changes, no new dependencies, no API changes, and no changes to control flow or arithmetic.
Changed components
base58/src/lib.rshashes/src/hkdf/mod.rsunits/src/amount/unsigned.rsunits/src/fee_rate/serde.rsInspect captured patch +16 / −12
### base58/src/lib.rs
@@ -115,7 +115,8 @@ static BASE58_DIGITS: [Option<u8>; 128] = [
fn build_base256<T: Buffer>(data: &str, scratch: &mut T) -> Result<(), Base256Error<T::Err>> {
for d58 in data.bytes() {
// Compute "X = X * 58 + next_digit" in base 256
- let mut carry = BASE58_DIGITS.get(usize::from(d58))
+ let mut carry = BASE58_DIGITS
+ .get(usize::from(d58))
.copied()
.flatten()
.ok_or(Base256Error::InvalidChar(InvalidCharacterError::new(d58)))
### hashes/src/hkdf/mod.rs
@@ -91,11 +91,8 @@ where
let t = engine.finalize();
let start_index = (counter - 1) * T::Hash::LEN;
// Last block might not take full hash length.
- let end_index = if counter == total_blocks {
- okm.len()
- } else {
- counter * T::Hash::LEN
- };
+ let end_index =
+ if counter == total_blocks { okm.len() } else { counter * T::Hash::LEN };
okm[start_index..end_index].copy_from_slice(&t.as_ref()[0..(end_index - start_index)]);
}
### units/src/amount/unsigned.rs
@@ -485,10 +485,12 @@ impl Amount {
let sats = self.to_sat() as u128;
match (sats * 4_000_000).checked_div(wu) {
- Some(fee_rate) if fee_rate <= const_casts::u64_to_u128(u64::MAX) => {
- R::Valid(FeeRate::from_sat_per_mvb(fee_rate as u64))
- },
- Some(_) => R::Error(E::while_doing(MathErrorKind::Overflow { op: MathOp::Div, is_negative: false })),
+ Some(fee_rate) if fee_rate <= const_casts::u64_to_u128(u64::MAX) =>
+ R::Valid(FeeRate::from_sat_per_mvb(fee_rate as u64)),
+ Some(_) => R::Error(E::while_doing(MathErrorKind::Overflow {
+ op: MathOp::Div,
+ is_negative: false,
+ })),
None => R::Error(E::while_doing(MathErrorKind::DivByZero)),
}
}
@@ -522,7 +524,10 @@ impl Amount {
if fee_rate <= const_casts::u64_to_u128(u64::MAX) {
R::Valid(FeeRate::from_sat_per_mvb(fee_rate as u64))
} else {
- R::Error(E::while_doing(MathErrorKind::Overflow { op: MathOp::Div, is_negative: false }))
+ R::Error(E::while_doing(MathErrorKind::Overflow {
+ op: MathOp::Div,
+ is_negative: false,
+ }))
}
}
### units/src/fee_rate/serde.rs
@@ -43,7 +43,8 @@ pub mod as_sat_per_kwu_floor {
#[inline]
pub fn deserialize<'d, D: Deserializer<'d>>(d: D) -> Result<FeeRate, D::Error> {
let sat = u64::deserialize(d)?;
- let amt = Amount::from_sat(sat).map_err(|_| serde::de::Error::custom("amount out of range"))?;
+ let amt =
+ Amount::from_sat(sat).map_err(|_| serde::de::Error::custom("amount out of range"))?;
Ok(FeeRate::from_per_kwu(amt))
}
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.