From 033d24cfa2f47a33231952863c3478aba3919623 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Fri, 29 Mar 2024 18:57:02 -0600 Subject: [PATCH] nicer debug on merkle `Tree` --- ssz-rs/src/merkleization/merkleize.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ssz-rs/src/merkleization/merkleize.rs b/ssz-rs/src/merkleization/merkleize.rs index 5f82bfed..894d0c68 100644 --- a/ssz-rs/src/merkleization/merkleize.rs +++ b/ssz-rs/src/merkleization/merkleize.rs @@ -242,12 +242,9 @@ impl Index for Tree { impl std::fmt::Debug for Tree { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - for chunk in self.0.chunks(BYTES_PER_CHUNK) { - let node = hex::encode(chunk); - f.write_str(&node)?; - f.write_str(",\n")?; - } - Ok(()) + f.debug_list() + .entries(self.0.chunks(BYTES_PER_CHUNK).map(|chunk| hex::encode(chunk))) + .finish() } }