From 21e1b9dbbd6e2eb40380bb65b5de70125b34eaef Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 21 Apr 2022 12:38:50 +1000 Subject: [PATCH 1/3] Use secp256k1 qualified path instead of underscore We can use the qualified path for create type aliases, this is arguably easier to read and reduces the number of LOC. --- src/util/schnorr.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/util/schnorr.rs b/src/util/schnorr.rs index 20b7894c..4c2fca73 100644 --- a/src/util/schnorr.rs +++ b/src/util/schnorr.rs @@ -20,8 +20,6 @@ use core::fmt; use prelude::*; -use secp256k1::{XOnlyPublicKey as _XOnlyPublicKey, KeyPair as _KeyPair}; - use secp256k1::{self, Secp256k1, Verification, constants}; use hashes::Hash; use util::taproot::{TapBranchHash, TapTweakHash}; @@ -29,11 +27,11 @@ use SchnorrSighashType; /// Deprecated re-export of [`secp256k1::XOnlyPublicKey`] #[deprecated(since = "0.28.0", note = "Please use `util::key::XOnlyPublicKey` instead")] -pub type XOnlyPublicKey = _XOnlyPublicKey; +pub type XOnlyPublicKey = secp256k1::XOnlyPublicKey; /// Deprecated re-export of [`secp256k1::KeyPair`] #[deprecated(since = "0.28.0", note = "Please use `util::key::KeyPair` instead")] -pub type KeyPair = _KeyPair; +pub type KeyPair = secp256k1::KeyPair; /// Untweaked BIP-340 X-coord-only public key pub type UntweakedPublicKey = ::XOnlyPublicKey; From 80e0fb76731d11f026ceba5263597c2be4c33e59 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 21 Apr 2022 12:45:42 +1000 Subject: [PATCH 2/3] Remove unnecessary 'as' statement We can just use `self`, no idea why the `self as io` is there. --- src/util/bip158.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/bip158.rs b/src/util/bip158.rs index 1dc67ca1..8886dfa9 100644 --- a/src/util/bip158.rs +++ b/src/util/bip158.rs @@ -47,7 +47,7 @@ use prelude::*; -use io::{self as io, Cursor}; +use io::{self, Cursor}; use core::fmt::{self, Display, Formatter}; use core::cmp::{self, Ordering}; From 7307363c2ec06f5b8d81d4ba595c2a944e6e5ba8 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 21 Apr 2022 12:47:58 +1000 Subject: [PATCH 3/3] Use qualified path instead of alias It is more typical in this repo to use `module::Error` instead of a type alias when importing. Use `hex::Error` directly instead of `use hex::Error as HexError`. --- src/blockdata/constants.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/blockdata/constants.rs b/src/blockdata/constants.rs index bb0ac0b5..4ad8079e 100644 --- a/src/blockdata/constants.rs +++ b/src/blockdata/constants.rs @@ -23,7 +23,7 @@ use prelude::*; use core::default::Default; -use hashes::hex::{HexIterator, Error as HexError}; +use hashes::hex::{self, HexIterator}; use hashes::sha256d; use blockdata::opcodes; use blockdata::script; @@ -99,7 +99,7 @@ fn bitcoin_genesis_tx() -> Transaction { }); // Outputs - let script_bytes: Result, HexError> = + let script_bytes: Result, hex::Error> = HexIterator::new("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f").unwrap() .collect(); let out_script = script::Builder::new()