diff options
author | Richo Healey <richo@stripe.com> | 2018-12-03 19:51:29 -0800 |
---|---|---|
committer | Richo Healey <richo@stripe.com> | 2018-12-03 19:51:29 -0800 |
commit | e6f5c622ab6385badb9c45c129c37a742e1b94bb (patch) | |
tree | 6a7ca7d9c79f75846dc6053c523cce0f23d5b6cc | |
parent | f711998adedff93810590ee10b652c4fa3d4e66b (diff) | |
download | PAKEs-e6f5c622ab6385badb9c45c129c37a742e1b94bb.tar.xz |
More idiomatic Debug impl
-rw-r--r-- | spake2/src/lib.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/spake2/src/lib.rs b/spake2/src/lib.rs index 07fb4df..08e0057 100644 --- a/spake2/src/lib.rs +++ b/spake2/src/lib.rs @@ -820,15 +820,13 @@ fn maybe_utf8(s: &[u8]) -> String { } impl<G: Group> fmt::Debug for SPAKE2<G> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!( - f, - "SPAKE2(G=?, side={:?}, idA={}, idB={}, idS={})", - self.side, - maybe_utf8(&self.id_a), - maybe_utf8(&self.id_b), - maybe_utf8(&self.id_s) - ) + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt.debug_struct("SPAKE2") + .field("side", &self.side) + .field("idA", &maybe_utf8(&self.id_a)) + .field("idB", &maybe_utf8(&self.id_b)) + .field("idS", &maybe_utf8(&self.id_s)) + .finish() } } |