Skip to content

Commit

Permalink
Implement Debug when no std feature
Browse files Browse the repository at this point in the history
The `Debug` implementation for secrets is feature gated on `std`, this
means we cannot build cleanly with `--no-default-features`.

When the `std` feature is not enabled implement a dummy version of
`Debug` that just displays

   <secret requires std feature to display>
  • Loading branch information
tcharding committed Jan 25, 2022
1 parent b09c735 commit 631b96f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/secret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ macro_rules! impl_display_secret {
.finish()
}
}

#[cfg(not(feature = "std"))]
impl ::core::fmt::Debug for $thing {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
write!(f, "<secret requires std feature to display>")
}
}
}
}

Expand Down

0 comments on commit 631b96f

Please sign in to comment.