From 9d688396c9dc862a4413d7a169d5f949e382e70c Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Mon, 26 Feb 2024 08:45:58 +1100 Subject: [PATCH] base58: Use pub extern crate instead of module We don't add any implementations to the `base58` types so we can just `pub extern` the crate instead of using a module and re-exporting. --- bitcoin/src/address/error.rs | 2 +- bitcoin/src/address/mod.rs | 1 - bitcoin/src/bip32.rs | 1 - bitcoin/src/crypto/key.rs | 1 - bitcoin/src/lib.rs | 8 +++----- 5 files changed, 4 insertions(+), 9 deletions(-) diff --git a/bitcoin/src/address/error.rs b/bitcoin/src/address/error.rs index c522656e..78e50633 100644 --- a/bitcoin/src/address/error.rs +++ b/bitcoin/src/address/error.rs @@ -7,7 +7,7 @@ use internals::write_err; use crate::address::{Address, NetworkUnchecked}; use crate::blockdata::script::{witness_program, witness_version}; use crate::prelude::*; -use crate::{base58, Network}; +use crate::Network; /// Address error. #[derive(Debug, Clone, PartialEq, Eq)] diff --git a/bitcoin/src/address/mod.rs b/bitcoin/src/address/mod.rs index a8e058e6..8ab6f5b3 100644 --- a/bitcoin/src/address/mod.rs +++ b/bitcoin/src/address/mod.rs @@ -36,7 +36,6 @@ use bech32::primitives::hrp::Hrp; use hashes::{sha256, Hash, HashEngine}; use secp256k1::{Secp256k1, Verification, XOnlyPublicKey}; -use crate::base58; use crate::blockdata::constants::{ MAX_SCRIPT_ELEMENT_SIZE, PUBKEY_ADDRESS_PREFIX_MAIN, PUBKEY_ADDRESS_PREFIX_TEST, SCRIPT_ADDRESS_PREFIX_MAIN, SCRIPT_ADDRESS_PREFIX_TEST, diff --git a/bitcoin/src/bip32.rs b/bitcoin/src/bip32.rs index 23b4cfde..7a7432a3 100644 --- a/bitcoin/src/bip32.rs +++ b/bitcoin/src/bip32.rs @@ -15,7 +15,6 @@ use internals::{impl_array_newtype, write_err}; use io::Write; use secp256k1::{Secp256k1, XOnlyPublicKey}; -use crate::base58; use crate::crypto::key::{CompressedPublicKey, Keypair, PrivateKey}; use crate::internal_macros::impl_bytes_newtype; use crate::prelude::*; diff --git a/bitcoin/src/crypto/key.rs b/bitcoin/src/crypto/key.rs index 7b143524..364a946c 100644 --- a/bitcoin/src/crypto/key.rs +++ b/bitcoin/src/crypto/key.rs @@ -21,7 +21,6 @@ use crate::internal_macros::impl_asref_push_bytes; use crate::network::NetworkKind; use crate::prelude::*; use crate::taproot::{TapNodeHash, TapTweakHash}; -use crate::base58; #[rustfmt::skip] // Keep public re-exports separate. pub use secp256k1::{constants, Keypair, Parity, Secp256k1, Verification, XOnlyPublicKey}; diff --git a/bitcoin/src/lib.rs b/bitcoin/src/lib.rs index c9f92e6b..a8540de1 100644 --- a/bitcoin/src/lib.rs +++ b/bitcoin/src/lib.rs @@ -61,6 +61,9 @@ extern crate alloc; /// Encodes and decodes base64 as bytes or utf8. pub extern crate base64; +/// Bitcoin base58 encoding and decoding. +pub extern crate base58; + /// Rust implementation of cryptographic hash function algorithms. pub extern crate hashes; @@ -195,8 +198,3 @@ pub mod amount { } } } - -pub mod base58 { - //! Bitcoin base58 encoding and decoding. - pub use base58::{decode, decode_check, encode, encode_check, encode_check_to_fmt, Error}; -}