What changed, and why it matters
This commit is purely a code formatting cleanup. It removes blank lines, reorders some import/module declarations, and collapses a few trivial function bodies onto one line. There are no functional changes to how the software behaves, and no security implications.
No action required; this is a non-functional formatting commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff shows only cosmetic changes produced by running a Rust formatter (likely rustfmt). Examples include removing a trailing blank line in a struct definition, collapsing a struct literal and a one-line constructor onto single lines, reordering re-exports and module declarations, and adding/removing blank lines around imports. No logic, API, or behavior changes are present.
Changed components
Inspect captured patch +9 / −16
diff --git a/bitcoin/examples/serde.rs b/bitcoin/examples/serde.rs
index 74080cf4..758acf3a 100644
--- a/bitcoin/examples/serde.rs
+++ b/bitcoin/examples/serde.rs
@@ -24,15 +24,10 @@ pub struct Foo {
/// `FeeRate` can use kilo weight units or virtual bytes, both floor and ceil.
#[serde(with = "fee_rate::serde::as_sat_per_kwu_floor")]
fee_rate: FeeRate,
-
}
fn main() {
- let f = Foo {
- header: dummy_header(),
- amount: Amount::ONE_BTC,
- fee_rate: FeeRate::DUST,
- };
+ let f = Foo { header: dummy_header(), amount: Amount::ONE_BTC, fee_rate: FeeRate::DUST };
let s = serde_json::to_string(&f).unwrap();
println!("{s}");
diff --git a/bitcoin/src/lib.rs b/bitcoin/src/lib.rs
index 7fc8c3e5..edb13c99 100644
--- a/bitcoin/src/lib.rs
+++ b/bitcoin/src/lib.rs
@@ -149,6 +149,9 @@ pub mod taproot;
// Re-export the type from where it is defined but the module from the highest place up the stack
// that it is available in the event that we add some functionality there.
#[doc(inline)]
+#[cfg(feature = "serde")]
+pub use primitives::serde_as_consensus;
+#[doc(inline)]
pub use primitives::{
block::{
compute_merkle_root, compute_witness_root, Block, BlockHash, Checked as BlockChecked,
@@ -178,9 +181,6 @@ pub use units::{
time::{self, BlockTime, BlockTimeDecoder, BlockTimeDecoderError},
weight::Weight,
};
-#[doc(inline)]
-#[cfg(feature = "serde")]
-pub use primitives::serde_as_consensus;
#[deprecated(since = "TBD", note = "use `BlockHeightInterval` instead")]
#[doc(hidden)]
diff --git a/hashes/src/sha256/mod.rs b/hashes/src/sha256/mod.rs
index cf7783fd..893ca2ac 100644
--- a/hashes/src/sha256/mod.rs
+++ b/hashes/src/sha256/mod.rs
@@ -214,8 +214,7 @@ impl Midstate {
/// Constructs a new [`HashEngine`] from this [`Midstate`].
pub fn to_engine(self) -> HashEngine {
let mut ret = [0; 8];
- for (ret_val, midstate_bytes) in ret.iter_mut().zip(self.as_ref().bitcoin_as_chunks().0)
- {
+ for (ret_val, midstate_bytes) in ret.iter_mut().zip(self.as_ref().bitcoin_as_chunks().0) {
*ret_val = u32::from_be_bytes(*midstate_bytes);
}
diff --git a/p2p/src/message.rs b/p2p/src/message.rs
index 3f93ce62..fb255ba7 100644
--- a/p2p/src/message.rs
+++ b/p2p/src/message.rs
@@ -668,9 +668,7 @@ pub struct Ping(u64);
impl Ping {
/// Constructs a new [`Ping`] message from nonce.
- pub fn new(nonce: u64) -> Self {
- Self(nonce)
- }
+ pub fn new(nonce: u64) -> Self { Self(nonce) }
}
encoding::encoder_newtype! {
diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs
index 57c16e35..4f23c5cc 100644
--- a/primitives/src/lib.rs
+++ b/primitives/src/lib.rs
@@ -52,10 +52,10 @@ mod opcodes;
pub mod block;
pub mod merkle_tree;
-#[cfg(all(feature = "serde", feature = "hex", feature = "alloc"))]
-pub mod serde_as_consensus;
#[cfg(feature = "alloc")]
pub mod script;
+#[cfg(all(feature = "serde", feature = "hex", feature = "alloc"))]
+pub mod serde_as_consensus;
pub mod transaction;
#[cfg(feature = "alloc")]
pub mod witness;
diff --git a/primitives/src/serde_as_consensus.rs b/primitives/src/serde_as_consensus.rs
index c24b0901..47ddb0bf 100644
--- a/primitives/src/serde_as_consensus.rs
+++ b/primitives/src/serde_as_consensus.rs
@@ -75,6 +75,7 @@ where
{
if d.is_human_readable() {
use alloc::string::String;
+
use serde::Deserialize;
let hex_str = String::deserialize(d)?;
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.