What changed, and why it matters
This commit is purely a code-formatting cleanup performed by an automated rustfmt nightly run. It reorders imports, collapses or expands brace blocks, removes blank lines, and adjusts line wrapping in test code. No program logic, APIs, or security behavior was changed.
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 shows only stylistic changes generated by rustfmt across four files: bitcoin/src/merkle_tree/block.rs, bitcoin/src/psbt/mod.rs, network/src/lib.rs, and primitives/src/transaction.rs. Changes include import reordering (core::cmp before hex imports), collapsing single-field struct constructors onto one line, removing extra blank lines, and reformatting long expressions and array literals. All modified code is inside #[cfg(test)] modules except for a single blank-line change in network/src/lib.rs. No functional code, signatures, or control flow were altered.
Changed components
Inspect captured patch +45 / −53
diff --git a/bitcoin/src/merkle_tree/block.rs b/bitcoin/src/merkle_tree/block.rs
index 0fdcf89b..b27e81f9 100644
--- a/bitcoin/src/merkle_tree/block.rs
+++ b/bitcoin/src/merkle_tree/block.rs
@@ -530,9 +530,10 @@ impl<'a> Arbitrary<'a> for MerkleBlock {
#[cfg(test)]
mod tests {
+ use core::cmp;
+
use hex::{DisplayHex, FromHex};
use hex_lit::hex;
- use core::cmp;
use super::*;
use crate::block::Unchecked;
@@ -551,11 +552,7 @@ mod tests {
const P: usize = 1039;
const Q: usize = 677;
- const fn new(seed: usize) -> Self {
- Self {
- state: seed
- }
- }
+ const fn new(seed: usize) -> Self { Self { state: seed } }
#[inline]
fn next_usize(&mut self) -> usize {
@@ -564,14 +561,10 @@ mod tests {
}
#[inline]
- fn next_in_range(&mut self, max: usize) -> usize {
- self.next_usize() % max
- }
+ fn next_in_range(&mut self, max: usize) -> usize { self.next_usize() % max }
#[inline]
- fn next_u8(&mut self) -> u8 {
- self.next_usize().to_le_bytes()[0]
- }
+ fn next_u8(&mut self) -> u8 { self.next_usize().to_le_bytes()[0] }
}
macro_rules! pmt_tests {
diff --git a/bitcoin/src/psbt/mod.rs b/bitcoin/src/psbt/mod.rs
index 38a5dac7..274c6d11 100644
--- a/bitcoin/src/psbt/mod.rs
+++ b/bitcoin/src/psbt/mod.rs
@@ -2508,54 +2508,49 @@ mod tests {
version: transaction::Version::TWO,
lock_time: absolute::LockTime::ZERO,
inputs: vec![],
- outputs: vec![
- TxOut {
- amount: Amount::default(),
- script_pubkey: ScriptPubKeyBuf::new()
- }
- ],
+ outputs: vec![TxOut {
+ amount: Amount::default(),
+ script_pubkey: ScriptPubKeyBuf::new(),
+ }],
};
-
+
let unsigned_tx = Transaction {
version: transaction::Version::TWO,
lock_time: absolute::LockTime::ZERO,
- inputs: vec![
- TxIn {
- previous_output: OutPoint {
- txid: prev_tx.compute_txid(),
- vout: 5, // This doesn't have a corresponding output
- },
- script_sig: ScriptSigBuf::new(),
- sequence: Sequence::default(),
- witness: Witness::new(),
- }
- ],
- outputs: vec![
- TxOut {
- amount: Amount::default(),
- script_pubkey: ScriptPubKeyBuf::new(),
- }
- ],
+ inputs: vec![TxIn {
+ previous_output: OutPoint {
+ txid: prev_tx.compute_txid(),
+ vout: 5, // This doesn't have a corresponding output
+ },
+ script_sig: ScriptSigBuf::new(),
+ sequence: Sequence::default(),
+ witness: Witness::new(),
+ }],
+ outputs: vec![TxOut {
+ amount: Amount::default(),
+ script_pubkey: ScriptPubKeyBuf::new(),
+ }],
};
-
+
let psbt = Psbt {
unsigned_tx,
version: 0,
- xpub: Default::default(),
+ xpub: Default::default(),
proprietary: Default::default(),
unknown: Default::default(),
- inputs: vec![
- Input {
- non_witness_utxo: Some(prev_tx),
- witness_utxo: None,
- ..Default::default()
- }
- ],
+ inputs: vec![Input {
+ non_witness_utxo: Some(prev_tx),
+ witness_utxo: None,
+ ..Default::default()
+ }],
outputs: vec![Output::default()],
};
-
+
assert!(matches!(psbt.fee(), Err(Error::PsbtUtxoOutOfbounds)));
- assert!(matches!(psbt.internal_extract_tx_with_fee_rate_limit(FeeRate::MAX), Err(ExtractTxError::MissingInputAmount { tx: _ })))
+ assert!(matches!(
+ psbt.internal_extract_tx_with_fee_rate_limit(FeeRate::MAX),
+ Err(ExtractTxError::MissingInputAmount { tx: _ })
+ ))
}
#[test]
diff --git a/network/src/lib.rs b/network/src/lib.rs
index 0987d808..14a7eb5d 100644
--- a/network/src/lib.rs
+++ b/network/src/lib.rs
@@ -197,7 +197,7 @@ pub mod as_core_arg {
#![allow(clippy::missing_errors_doc)]
use crate::Network;
-
+
#[allow(clippy::trivially_copy_pass_by_ref)] // `serde` controls the API.
pub fn serialize<S>(network: &Network, serializer: S) -> Result<S::Ok, S::Error>
where
diff --git a/primitives/src/transaction.rs b/primitives/src/transaction.rs
index f8897207..53788572 100644
--- a/primitives/src/transaction.rs
+++ b/primitives/src/transaction.rs
@@ -2491,13 +2491,17 @@ mod tests {
let expected_outpoint = OutPoint {
txid: Txid::from_byte_array([
- 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
]),
vout: 0,
};
- assert_eq!(err, TransactionDecoderError(TransactionDecoderErrorInner::DuplicateInput(expected_outpoint)));
+ assert_eq!(
+ err,
+ TransactionDecoderError(TransactionDecoderErrorInner::DuplicateInput(
+ expected_outpoint
+ ))
+ );
}
}
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.