Shield hash_newtypes from rustfmt

In preparation for running the formatter on root level modules and a
submodule that holds all the macro calls in `hash_types` so we can
configure rustfmt to skip formatting them.
This commit is contained in:
Tobin C. Harding 2022-06-06 14:09:56 +10:00
parent 65d19d9044
commit 01471f7e65
1 changed files with 31 additions and 26 deletions

View File

@ -9,8 +9,6 @@
//! hash). //! hash).
//! //!
use bitcoin_hashes::{sha256, sha256d, hash160, hash_newtype};
macro_rules! impl_hashencode { macro_rules! impl_hashencode {
($hashtype:ident) => { ($hashtype:ident) => {
impl $crate::consensus::Encodable for $hashtype { impl $crate::consensus::Encodable for $hashtype {
@ -28,6 +26,13 @@ macro_rules! impl_hashencode {
} }
} }
// newtypes module is solely here so we can rustfmt::skip.
pub use newtypes::*;
#[rustfmt::skip]
mod newtypes {
use crate::hashes::{sha256, sha256d, hash160, hash_newtype};
hash_newtype!( hash_newtype!(
Txid, sha256d::Hash, 32, doc="A bitcoin transaction hash/transaction ID. Txid, sha256d::Hash, 32, doc="A bitcoin transaction hash/transaction ID.
@ -54,7 +59,6 @@ hash_newtype!(XpubIdentifier, hash160::Hash, 20, doc="XpubIdentifier as defined
hash_newtype!(FilterHash, sha256d::Hash, 32, doc="Filter hash, as defined in BIP-157"); hash_newtype!(FilterHash, sha256d::Hash, 32, doc="Filter hash, as defined in BIP-157");
hash_newtype!(FilterHeader, sha256d::Hash, 32, doc="Filter header, as defined in BIP-157"); hash_newtype!(FilterHeader, sha256d::Hash, 32, doc="Filter header, as defined in BIP-157");
impl_hashencode!(Txid); impl_hashencode!(Txid);
impl_hashencode!(Wtxid); impl_hashencode!(Wtxid);
impl_hashencode!(BlockHash); impl_hashencode!(BlockHash);
@ -65,3 +69,4 @@ impl_hashencode!(WitnessMerkleNode);
impl_hashencode!(FilterHash); impl_hashencode!(FilterHash);
impl_hashencode!(FilterHeader); impl_hashencode!(FilterHeader);
}