What changed, and why it matters
This is an automated code-formatting commit. It only changes whitespace, line breaks, import order, and minor punctuation to match the latest rustfmt style. No program logic, APIs, or security behavior changed.
No action needed; this is a routine formatting-only change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit applies rustfmt nightly formatting: removes a blank line, rewraps long use statements, reorders imports alphabetically, and collapses some small functions/structs onto single lines. There are no functional code changes, no new dependencies, no unsafe blocks, no cryptographic changes, and no test behavior changes.
Changed components
primitives/src/lib.rsprimitives/tests/api.rsunits/tests/serde.rsInspect captured patch +23 / −38
diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs
index 7c282316..92e9262f 100644
--- a/primitives/src/lib.rs
+++ b/primitives/src/lib.rs
@@ -19,7 +19,6 @@
#![doc(test(attr(warn(unused))))]
// Package-specific lint overrides.
-
#[cfg(feature = "alloc")]
extern crate alloc;
diff --git a/primitives/tests/api.rs b/primitives/tests/api.rs
index a1af2e69..f1cf4ee0 100644
--- a/primitives/tests/api.rs
+++ b/primitives/tests/api.rs
@@ -211,7 +211,11 @@ fn api_can_use_units_modules_from_crate_root() {
#[test]
fn api_can_use_units_types_from_crate_root() {
- use bitcoin_primitives::{Amount, BlockHeight, BlockHeightInterval, BlockMtp, BlockMtpInterval, FeeRate, NumOpResult, Sequence, BlockTime, BlockTimeDecoder, BlockTimeDecoderError, SignedAmount, Weight};
+ use bitcoin_primitives::{
+ Amount, BlockHeight, BlockHeightInterval, BlockMtp, BlockMtpInterval, BlockTime,
+ BlockTimeDecoder, BlockTimeDecoderError, FeeRate, NumOpResult, Sequence, SignedAmount,
+ Weight,
+ };
}
#[test]
diff --git a/units/tests/serde.rs b/units/tests/serde.rs
index dafd594a..b9e5132e 100644
--- a/units/tests/serde.rs
+++ b/units/tests/serde.rs
@@ -6,10 +6,13 @@
#![cfg(feature = "serde")]
use bincode::serialize;
-use bitcoin_units::{amount, fee_rate, Amount, BlockHeight, BlockHeightInterval, BlockTime, FeeRate, Sequence, SignedAmount, Weight};
-use serde::{Deserialize, Serialize};
-use bitcoin_units::absolute::{LockTime as AbsoluteLockTime, Height, MedianTimePast};
+use bitcoin_units::absolute::{Height, LockTime as AbsoluteLockTime, MedianTimePast};
use bitcoin_units::relative::{LockTime as RelativeLockTime, NumberOf512Seconds, NumberOfBlocks};
+use bitcoin_units::{
+ amount, fee_rate, Amount, BlockHeight, BlockHeightInterval, BlockTime, FeeRate, Sequence,
+ SignedAmount, Weight,
+};
+use serde::{Deserialize, Serialize};
/// A struct that includes all the types that implement or support `serde` traits.
#[derive(Debug, Serialize, Deserialize)]
@@ -300,14 +303,10 @@ fn serde_amount_as_str_opt() {
}
#[track_caller]
-fn fee_rate_vb(vb: u32) -> FeeRate {
- FeeRate::from_sat_per_vb(vb)
-}
+fn fee_rate_vb(vb: u32) -> FeeRate { FeeRate::from_sat_per_vb(vb) }
#[track_caller]
-fn fee_rate_kwu(vb: u32) -> FeeRate {
- FeeRate::from_sat_per_kwu(vb)
-}
+fn fee_rate_kwu(vb: u32) -> FeeRate { FeeRate::from_sat_per_kwu(vb) }
#[test]
#[cfg(feature = "serde")]
@@ -502,15 +501,12 @@ fn serde_fee_rate_as_sat_per_vb_ceil_opt() {
#[cfg(feature = "serde")]
#[cfg(feature = "alloc")]
fn serde_as_block_height() {
-
#[derive(Serialize, Deserialize, PartialEq, Debug)]
struct T {
- pub block_height: BlockHeight
+ pub block_height: BlockHeight,
}
- let orig = T {
- block_height: BlockHeight::from_u32(123_456_789)
- };
+ let orig = T { block_height: BlockHeight::from_u32(123_456_789) };
let json = "{\"block_height\": 123456789}";
@@ -525,15 +521,12 @@ fn serde_as_block_height() {
#[cfg(feature = "serde")]
#[cfg(feature = "alloc")]
fn serde_as_block_interval() {
-
#[derive(Serialize, Deserialize, PartialEq, Debug)]
struct T {
- pub block_interval: BlockHeightInterval
+ pub block_interval: BlockHeightInterval,
}
- let orig = T {
- block_interval: BlockHeightInterval::from_u32(144)
- };
+ let orig = T { block_interval: BlockHeightInterval::from_u32(144) };
let json = "{\"block_interval\": 144}";
@@ -548,15 +541,12 @@ fn serde_as_block_interval() {
#[cfg(feature = "serde")]
#[cfg(feature = "alloc")]
fn serde_as_weight() {
-
#[derive(Serialize, Deserialize, PartialEq, Debug)]
struct T {
- pub weight: Weight
+ pub weight: Weight,
}
- let orig = T {
- weight: Weight::from_wu(25)
- };
+ let orig = T { weight: Weight::from_wu(25) };
let json = "{\"weight\": 25}";
@@ -571,15 +561,12 @@ fn serde_as_weight() {
#[cfg(feature = "serde")]
#[cfg(feature = "alloc")]
fn serde_as_block_time() {
-
#[derive(Serialize, Deserialize, PartialEq, Debug)]
struct T {
- pub block_time: BlockTime
+ pub block_time: BlockTime,
}
- let orig = T {
- block_time: BlockTime::from_u32(123_456_789)
- };
+ let orig = T { block_time: BlockTime::from_u32(123_456_789) };
let json = "{\"block_time\": 123456789}";
@@ -594,15 +581,12 @@ fn serde_as_block_time() {
#[cfg(feature = "serde")]
#[cfg(feature = "alloc")]
fn serde_as_sequence_from_hex() {
-
#[derive(Serialize, Deserialize, PartialEq, Debug)]
struct T {
- pub sequence: Sequence
+ pub sequence: Sequence,
}
- let orig = T {
- sequence: Sequence::from_hex("0x0040ffff").unwrap()
- };
+ let orig = T { sequence: Sequence::from_hex("0x0040ffff").unwrap() };
let json = "{\"sequence\": 4259839}";
@@ -617,7 +601,6 @@ fn serde_as_sequence_from_hex() {
#[cfg(feature = "serde")]
#[cfg(feature = "alloc")]
fn serde_as_locktime_from_blocks() {
-
#[derive(Serialize, Deserialize, PartialEq, Debug)]
struct T {
pub a_lt: AbsoluteLockTime,
@@ -642,7 +625,6 @@ fn serde_as_locktime_from_blocks() {
#[cfg(feature = "serde")]
#[cfg(feature = "alloc")]
fn serde_as_locktime_from_time() {
-
#[derive(Serialize, Deserialize, PartialEq, Debug)]
struct T {
pub a_lt: AbsoluteLockTime,
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.