What changed, and why it matters
This commit is purely a code-formatting cleanup. It runs the Rust formatter (cargo fmt) across six files, changing only whitespace, line breaks, and import order. No program logic, security behavior, or functionality was altered.
No security action needed; this is a routine style-only commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff shows only formatting changes produced by cargo fmt: reordered/rewrapped imports, adjusted line wrapping for function calls and array literals, and reindented unsafe blocks. There are no semantic changes to code paths, no new dependencies, no API changes, and no bug fixes.
Changed components
Inspect captured patch +31 / −18
diff --git a/bitcoin/embedded/src/main.rs b/bitcoin/embedded/src/main.rs
index c11ed734..42c02d40 100644
--- a/bitcoin/embedded/src/main.rs
+++ b/bitcoin/embedded/src/main.rs
@@ -11,11 +11,10 @@ use alloc::vec;
use core::panic::PanicInfo;
use alloc_cortex_m::CortexMHeap;
-// use panic_halt as _;
-use bitcoin::{Address, Network, PrivateKey};
use bitcoin::secp256k1::ffi::types::AlignedType;
use bitcoin::secp256k1::Secp256k1;
-
+// use panic_halt as _;
+use bitcoin::{Address, Network, PrivateKey};
use cortex_m_rt::entry;
use cortex_m_semihosting::{debug, hprintln};
@@ -32,7 +31,7 @@ fn main() -> ! {
unsafe { ALLOCATOR.init(cortex_m_rt::heap_start() as usize, HEAP_SIZE) }
let size = Secp256k1::preallocate_size();
- hprintln!("secp buf size {}", size*16).unwrap();
+ hprintln!("secp buf size {}", size * 16).unwrap();
// Load a private key
let raw = "L1HKVVLHXiUhecWnwFYF6L3shkf1E12HUmuZTESvBXUdx3yqVP1D";
diff --git a/bitcoin/src/crypto/sighash.rs b/bitcoin/src/crypto/sighash.rs
index a2b6a6dd..a929c77c 100644
--- a/bitcoin/src/crypto/sighash.rs
+++ b/bitcoin/src/crypto/sighash.rs
@@ -2025,8 +2025,11 @@ mod tests {
.taproot_signature_hash(tx_ind, &Prevouts::All(&utxos), None, None, hash_ty)
.unwrap();
- let key_spend_sig =
- secp.sign_schnorr_with_aux_rand(&sighash.to_byte_array(), &tweaked_keypair, &[0u8; 32]);
+ let key_spend_sig = secp.sign_schnorr_with_aux_rand(
+ &sighash.to_byte_array(),
+ &tweaked_keypair,
+ &[0u8; 32],
+ );
assert_eq!(expected.internal_pubkey, internal_key);
assert_eq!(expected.tweak, tweak);
diff --git a/bitcoin/src/psbt/mod.rs b/bitcoin/src/psbt/mod.rs
index afeba329..d23a2da3 100644
--- a/bitcoin/src/psbt/mod.rs
+++ b/bitcoin/src/psbt/mod.rs
@@ -447,7 +447,8 @@ impl Psbt {
#[cfg(feature = "rand-std")]
let signature = secp.sign_schnorr(&sighash.to_byte_array(), &key_pair);
#[cfg(not(feature = "rand-std"))]
- let signature = secp.sign_schnorr_no_aux_rand(&sighash.to_byte_array(), &key_pair);
+ let signature =
+ secp.sign_schnorr_no_aux_rand(&sighash.to_byte_array(), &key_pair);
let signature = taproot::Signature { signature, sighash_type };
input.tap_key_sig = Some(signature);
@@ -474,7 +475,8 @@ impl Psbt {
#[cfg(feature = "rand-std")]
let signature = secp.sign_schnorr(&sighash.to_byte_array(), &key_pair);
#[cfg(not(feature = "rand-std"))]
- let signature = secp.sign_schnorr_no_aux_rand(&sighash.to_byte_array(), &key_pair);
+ let signature =
+ secp.sign_schnorr_no_aux_rand(&sighash.to_byte_array(), &key_pair);
let signature = taproot::Signature { signature, sighash_type };
input.tap_script_sigs.insert((xonly, lh), signature);
diff --git a/fuzz/fuzz_targets/units/arbitrary_weight.rs b/fuzz/fuzz_targets/units/arbitrary_weight.rs
index 4fe66fed..96426075 100644
--- a/fuzz/fuzz_targets/units/arbitrary_weight.rs
+++ b/fuzz/fuzz_targets/units/arbitrary_weight.rs
@@ -1,6 +1,6 @@
use arbitrary::{Arbitrary, Unstructured};
-use honggfuzz::fuzz;
use bitcoin::Weight;
+use honggfuzz::fuzz;
fn do_test(data: &[u8]) {
let mut u = Unstructured::new(data);
@@ -33,7 +33,9 @@ fn do_test(data: &[u8]) {
}
// Constructors that return a Weight
- for constructor in [Weight::from_wu, Weight::from_witness_data_size, Weight::from_non_witness_data_size] {
+ for constructor in
+ [Weight::from_wu, Weight::from_witness_data_size, Weight::from_non_witness_data_size]
+ {
if let Ok(val) = u.arbitrary() {
constructor(val);
} else {
diff --git a/hashes/embedded/src/main.rs b/hashes/embedded/src/main.rs
index 3a19faaf..ca36383c 100644
--- a/hashes/embedded/src/main.rs
+++ b/hashes/embedded/src/main.rs
@@ -5,10 +5,13 @@
#[macro_use]
extern crate bitcoin_hashes;
-#[cfg(feature = "alloc")] extern crate alloc;
-#[cfg(feature = "alloc")] use alloc_cortex_m::CortexMHeap;
-#[cfg(feature = "alloc")] use alloc::string::ToString;
+#[cfg(feature = "alloc")]
+extern crate alloc;
+#[cfg(feature = "alloc")]
+use alloc::string::ToString;
+#[cfg(feature = "alloc")]
+use alloc_cortex_m::CortexMHeap;
use bitcoin_hashes::{sha256, HashEngine};
use bitcoin_io::Write;
use cortex_m_rt::entry;
@@ -37,7 +40,9 @@ const HEAP_SIZE: usize = 1024; // in bytes
#[entry]
fn main() -> ! {
#[cfg(feature = "alloc")]
- unsafe { ALLOCATOR.init(cortex_m_rt::heap_start() as usize, HEAP_SIZE) }
+ unsafe {
+ ALLOCATOR.init(cortex_m_rt::heap_start() as usize, HEAP_SIZE)
+ }
let mut engine = sha256::Hash::engine();
engine.write_all(b"abc").unwrap();
@@ -57,9 +62,9 @@ fn main() -> ! {
fn check_result(engine: sha256::HashEngine) {
let hash = TestType(sha256::Hash::from_engine(engine));
- let hash_check =
- "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad".parse::<TestType>()
- .unwrap();
+ let hash_check = "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"
+ .parse::<TestType>()
+ .unwrap();
hprintln!("hash:{} hash_check:{}", hash, hash_check).unwrap();
if hash != hash_check {
debug::exit(debug::EXIT_FAILURE);
diff --git a/units/src/weight.rs b/units/src/weight.rs
index 23c374c7..2c23c73e 100644
--- a/units/src/weight.rs
+++ b/units/src/weight.rs
@@ -91,7 +91,9 @@ impl Weight {
}
/// Constructs a new [`Weight`] from virtual bytes without an overflow check.
- pub const fn from_vb_unchecked(vb: u64) -> Self { Weight::from_wu(vb * Self::WITNESS_SCALE_FACTOR) }
+ pub const fn from_vb_unchecked(vb: u64) -> Self {
+ Weight::from_wu(vb * Self::WITNESS_SCALE_FACTOR)
+ }
/// Constructs a new [`Weight`] from witness size.
pub const fn from_witness_data_size(witness_size: u64) -> Self { Weight::from_wu(witness_size) }
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.