What changed, and why it matters
This commit is a routine automated code-formatting run by the rustfmt tool. It only changes whitespace, line breaks, and import grouping in six files. No program logic, security checks, or behavior were altered.
No security action needed; treat as normal maintenance formatting.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff consists entirely of rustfmt nightly style changes: splitting a combined use core::{...} import, collapsing/expanding brace formatting in function bodies and struct literals, and rewrapping a long write! macro call and a closure. There are no semantic changes, no new unsafe blocks, no modified algorithms, and no changes to public APIs or validation logic.
Changed components
consensus_encoding/tests/api.rscrypto/src/key.rsfuzz/fuzz_targets/hashes/arbitrary_json.rsinternals/src/array_vec.rskey_expression/src/bip32.rsprimitives/src/block.rsInspect captured patch +16 / −23
diff --git a/consensus_encoding/tests/api.rs b/consensus_encoding/tests/api.rs
index a47c1671..af1f9300 100644
--- a/consensus_encoding/tests/api.rs
+++ b/consensus_encoding/tests/api.rs
@@ -9,7 +9,8 @@
#![allow(dead_code)]
#![allow(unused_imports)]
-use core::{convert::Infallible, fmt};
+use core::convert::Infallible;
+use core::fmt;
use bitcoin_consensus_encoding::{
self as encoding, encoder_newtype, ArrayDecoder, ArrayEncoder, ArrayRefEncoder, BytesEncoder,
diff --git a/crypto/src/key.rs b/crypto/src/key.rs
index 2f8bf0ad..0b6c0a24 100644
--- a/crypto/src/key.rs
+++ b/crypto/src/key.rs
@@ -661,9 +661,7 @@ impl LegacyPublicKey {
/// Returns bitcoin 160-bit hash of the public key.
#[inline]
- pub fn pubkey_hash(&self) -> PubkeyHash {
- PubkeyHash(hash160::Hash::hash(&self.serialize()))
- }
+ pub fn pubkey_hash(&self) -> PubkeyHash { PubkeyHash(hash160::Hash::hash(&self.serialize())) }
/// Returns bitcoin 160-bit hash of the public key for witness program
///
diff --git a/fuzz/fuzz_targets/hashes/arbitrary_json.rs b/fuzz/fuzz_targets/hashes/arbitrary_json.rs
index 1d4e5b8e..9fff6f6d 100644
--- a/fuzz/fuzz_targets/hashes/arbitrary_json.rs
+++ b/fuzz/fuzz_targets/hashes/arbitrary_json.rs
@@ -14,10 +14,7 @@ struct Hmacs {
impl<'a> Arbitrary<'a> for Hmacs {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
- Ok(Self {
- sha1: u.arbitrary()?,
- sha512: u.arbitrary()?,
- })
+ Ok(Self { sha1: u.arbitrary()?, sha512: u.arbitrary()? })
}
}
@@ -30,11 +27,7 @@ struct Main {
impl<'a> Arbitrary<'a> for Main {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
- Ok(Self {
- hmacs: u.arbitrary()?,
- ripemd: u.arbitrary()?,
- sha2d: u.arbitrary()?,
- })
+ Ok(Self { hmacs: u.arbitrary()?, ripemd: u.arbitrary()?, sha2d: u.arbitrary()? })
}
}
diff --git a/internals/src/array_vec.rs b/internals/src/array_vec.rs
index a2cc2baa..9b466801 100644
--- a/internals/src/array_vec.rs
+++ b/internals/src/array_vec.rs
@@ -104,7 +104,9 @@ impl<T: Copy, const CAP: usize> ArrayVec<T, CAP> {
// * first being non-None implies the element exists therefore one-past the length <=
// CAP
// * all elements up to old_len were already filled and we just added one
- unsafe { self.set_len(old_len + 1); }
+ unsafe {
+ self.set_len(old_len + 1);
+ }
Ok(())
}
diff --git a/key_expression/src/bip32.rs b/key_expression/src/bip32.rs
index e6a6205a..b418889d 100644
--- a/key_expression/src/bip32.rs
+++ b/key_expression/src/bip32.rs
@@ -1409,7 +1409,11 @@ pub mod error {
impl fmt::Display for InvalidSeedLengthError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "invalid BIP-0032 master seed length: {} (expected 16 to 64 inclusive)", self.length)
+ write!(
+ f,
+ "invalid BIP-0032 master seed length: {} (expected 16 to 64 inclusive)",
+ self.length
+ )
}
}
diff --git a/primitives/src/block.rs b/primitives/src/block.rs
index 77e8f0e6..50573495 100644
--- a/primitives/src/block.rs
+++ b/primitives/src/block.rs
@@ -429,14 +429,9 @@ fn witness_commitment_from_coinbase(coinbase: &Transaction) -> Option<WitnessCom
}
// Commitment is in the last output that starts with magic bytes.
- if let Some(pos) = coinbase
- .outputs
- .iter()
- .rposition(|o| {
- o.script_pubkey.len() >= 38
- && o.script_pubkey.as_bytes()[0..6] == WITNESS_COMMITMENT_MAGIC
- })
- {
+ if let Some(pos) = coinbase.outputs.iter().rposition(|o| {
+ o.script_pubkey.len() >= 38 && o.script_pubkey.as_bytes()[0..6] == WITNESS_COMMITMENT_MAGIC
+ }) {
let bytes =
<[u8; 32]>::try_from(&coinbase.outputs[pos].script_pubkey.as_bytes()[6..38]).unwrap();
Some(WitnessCommitment::from_byte_array(bytes))
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.