What changed, and why it matters
This commit is purely a code-formatting cleanup. It removes blank lines, collapses a struct literal onto one line, reorders re-exports and module declarations, and adds a blank line between imports. There is no functional change and no security relevance.
No action required; this is a non-functional style-only 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. Examples: bitcoin/examples/serde.rs removes a trailing blank line and inlines a struct initializer; bitcoin/src/lib.rs and primitives/src/lib.rs reorder #[cfg]-gated re-exports/module declarations; p2p/src/message.rs collapses Ping::new to a single-line body; primitives/src/serde_as_consensus.rs adds a blank line between import groups. No logic, API, or behavior changes are present.
Changed components
Inspect captured patch +8 / −14
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/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.