From 5a4e7468ecd817c7acac9db4eb10a5fe9db6314d Mon Sep 17 00:00:00 2001 From: mcroad Date: Wed, 13 Apr 2022 21:10:19 -0500 Subject: [PATCH] Address use of `debug_non_exhaustive` Fixes #947 --- .gitignore | 1 + src/lib.rs | 1 + src/util/bip32.rs | 12 ++++++++++++ 3 files changed, 14 insertions(+) diff --git a/.gitignore b/.gitignore index bd1795fa1e..069d3cd10c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ Cargo.lock #fuzz fuzz/hfuzz_target fuzz/hfuzz_workspace +dep_test \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 0b7bc883dc..839568deeb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -44,6 +44,7 @@ // Experimental features we need #![cfg_attr(all(test, feature = "unstable"), feature(test))] +#![cfg_attr(feature = "unstable", feature(debug_non_exhaustive))] #![cfg_attr(docsrs, feature(doc_cfg))] diff --git a/src/util/bip32.rs b/src/util/bip32.rs index 65a973f5f3..2c7759b92e 100644 --- a/src/util/bip32.rs +++ b/src/util/bip32.rs @@ -67,6 +67,7 @@ serde_string_impl!(ExtendedPrivKey, "a BIP-32 extended private key"); #[cfg(not(feature = "std"))] #[cfg_attr(docsrs, doc(cfg(not(feature = "std"))))] impl fmt::Debug for ExtendedPrivKey { + #[cfg(feature = "unstable")] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ExtendedPrivKey") .field("network", &self.network) @@ -76,6 +77,17 @@ impl fmt::Debug for ExtendedPrivKey { .field("chain_code", &self.chain_code) .finish_non_exhaustive() } + #[cfg(not(feature = "unstable"))] + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("ExtendedPrivKey") + .field("network", &self.network) + .field("depth", &self.depth) + .field("parent_fingerprint", &self.parent_fingerprint) + .field("child_number", &self.child_number) + .field("chain_code", &self.chain_code) + .field("private_key", &"[redacted]") + .finish() + } } /// Extended public key