Skip to content

Commit

Permalink
Address use of debug_non_exhaustive
Browse files Browse the repository at this point in the history
  • Loading branch information
mcroad committed Apr 14, 2022
1 parent 85c4d48 commit 5a4e746
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,3 +4,4 @@ Cargo.lock
#fuzz
fuzz/hfuzz_target
fuzz/hfuzz_workspace
dep_test
1 change: 1 addition & 0 deletions src/lib.rs
Expand Up @@ -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))]

Expand Down
12 changes: 12 additions & 0 deletions src/util/bip32.rs
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 5a4e746

Please sign in to comment.