From e3d9376a9b62598e1e3e005c0e1accd39faf49a0 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Mon, 22 Jul 2024 12:10:28 -0500 Subject: [PATCH 1/4] units: Remove serde re-export We re-export to help users keep their dependencies in sync but `serde` is at `v1.0` so this is not really a problem. Remove the public re-export of `serde` (and with current MSRV we don't need the `extern crate` at all). --- units/src/lib.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/units/src/lib.rs b/units/src/lib.rs index 249e9867b..abd1875f8 100644 --- a/units/src/lib.rs +++ b/units/src/lib.rs @@ -27,10 +27,6 @@ extern crate alloc; #[cfg(feature = "std")] extern crate std; -/// A generic serialization/deserialization framework. -#[cfg(feature = "serde")] -pub extern crate serde; - pub mod amount; #[cfg(feature = "alloc")] pub mod block; From d1c876eda58a1d80384d89f76e65539cfe909a66 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Tue, 23 Jul 2024 01:48:20 -0500 Subject: [PATCH 2/4] Remove rustfmt attribute There are no other use statements so we do not need to keep the public ones separate with a `rustfmt` attribute. Remove the attribute and run the formatter. --- primitives/src/lib.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 5438df424..bd7d57f7d 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -32,12 +32,9 @@ pub mod locktime; pub mod opcodes; pub mod sequence; -#[rustfmt::skip] // Keep public re-exports separate. #[doc(inline)] #[cfg(feature = "alloc")] -pub use self::{ - locktime::{absolute, relative}, -}; +pub use self::locktime::{absolute, relative}; #[doc(inline)] pub use self::sequence::Sequence; From 7a44908aeeb7ae75b6193326112dbfdb11799a0c Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Tue, 23 Jul 2024 01:50:44 -0500 Subject: [PATCH 3/4] primitives: Use wildard re-export in locktimes We recently decided to use wildcard re-exports when re-exporting things from an identically named module in a sub crate, ie. to mirror the directory structure structure ala core/std. In the `primitives::locktime` modules re-export everything from the `units::locktime` modules using a wildcard. --- primitives/src/locktime/absolute.rs | 4 +--- primitives/src/locktime/relative.rs | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/primitives/src/locktime/absolute.rs b/primitives/src/locktime/absolute.rs index 964ee9016..93f31a2c6 100644 --- a/primitives/src/locktime/absolute.rs +++ b/primitives/src/locktime/absolute.rs @@ -17,9 +17,7 @@ use crate::absolute; #[rustfmt::skip] // Keep public re-exports separate. #[doc(inline)] -pub use units::locktime::absolute::{ - Height, Time, LOCK_TIME_THRESHOLD, ConversionError, ParseHeightError, ParseTimeError, -}; +pub use units::locktime::absolute::*; /// An absolute lock time value, representing either a block height or a UNIX timestamp (seconds /// since epoch). diff --git a/primitives/src/locktime/relative.rs b/primitives/src/locktime/relative.rs index 953582c9c..82b5da41d 100644 --- a/primitives/src/locktime/relative.rs +++ b/primitives/src/locktime/relative.rs @@ -18,7 +18,7 @@ use crate::Sequence; #[rustfmt::skip] // Keep public re-exports separate. #[doc(inline)] -pub use units::locktime::relative::{Height, Time, TimeOverflowError}; +pub use units::locktime::relative::*; /// A relative lock time value, representing either a block height or time (512 second intervals). /// From 991c73cdf9dbdbcd90b41d629d506b26cd440e73 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Tue, 23 Jul 2024 01:52:40 -0500 Subject: [PATCH 4/4] primitives: Re-export everything from units We recently decided to make everything in `units` available at the same path as in `primitives` and not re-export the actual `units` crate. Re-export everything from the `units` crate root at the `primitives` crate root using a wildcard. --- primitives/src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index bd7d57f7d..342352994 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -32,6 +32,9 @@ pub mod locktime; pub mod opcodes; pub mod sequence; +#[doc(inline)] +pub use units::*; + #[doc(inline)] #[cfg(feature = "alloc")] pub use self::locktime::{absolute, relative};