From d63e95b99b5183aa181a82eee89727f290a6c82d Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Tue, 19 Mar 2024 18:20:27 +1100 Subject: [PATCH 1/2] Remove wildcard re-exports of context types Wildcards make it hard to grep for where stuff comes from, explicit imports and re-exports are ... more explicit. Import and re-export explicitly instead of by using wildcards. --- src/context.rs | 2 +- src/lib.rs | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/context.rs b/src/context.rs index 61ab985..7383e62 100644 --- a/src/context.rs +++ b/src/context.rs @@ -5,7 +5,7 @@ use core::mem::ManuallyDrop; use core::ptr::NonNull; #[cfg(feature = "alloc")] -pub use self::alloc_only::*; +pub use self::alloc_only::{All, SignOnly, VerifyOnly}; use crate::ffi::types::{c_uint, c_void, AlignedType}; use crate::ffi::{self, CPtr}; use crate::{Error, Secp256k1}; diff --git a/src/lib.rs b/src/lib.rs index 9a092b5..9c5f462 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -174,8 +174,8 @@ use core::marker::PhantomData; use core::ptr::NonNull; use core::{fmt, mem, str}; -#[cfg(feature = "global-context")] -pub use context::global::SECP256K1; +#[cfg(all(feature = "global-context", feature = "std"))] +pub use context::global::{self, SECP256K1}; #[cfg(feature = "hashes")] use hashes::Hash; #[cfg(feature = "rand")] @@ -184,7 +184,12 @@ pub use secp256k1_sys as ffi; #[cfg(feature = "serde")] pub use serde; -pub use crate::context::*; +#[cfg(feature = "alloc")] +pub use crate::context::{All, SignOnly, VerifyOnly}; +pub use crate::context::{ + AllPreallocated, Context, PreallocatedContext, SignOnlyPreallocated, Signing, Verification, + VerifyOnlyPreallocated, +}; use crate::ffi::types::AlignedType; use crate::ffi::CPtr; pub use crate::key::{PublicKey, SecretKey, *}; From 0da394e64848baf93c0aca0a9d6b5c9b2648b908 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Tue, 19 Mar 2024 18:22:13 +1100 Subject: [PATCH 2/2] Remove wildcard re-exports of key types Wildcards make it hard to grep for where stuff comes from, explicit imports and re-exports are ... more explicit. Re-export the `key` types explicitly. --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 9c5f462..2c5bf60 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -192,7 +192,7 @@ pub use crate::context::{ }; use crate::ffi::types::AlignedType; use crate::ffi::CPtr; -pub use crate::key::{PublicKey, SecretKey, *}; +pub use crate::key::{InvalidParityValue, Keypair, Parity, PublicKey, SecretKey, XOnlyPublicKey}; pub use crate::scalar::Scalar; /// Trait describing something that promises to be a 32-byte random number; in particular,