From 2f1278271658306d4e1706808336870673e28c9b Mon Sep 17 00:00:00 2001 From: Wolfgang Welz Date: Thu, 19 Oct 2023 23:10:56 +0200 Subject: [PATCH] fix clippy (#45) --- primitives/src/trie/mpt.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/primitives/src/trie/mpt.rs b/primitives/src/trie/mpt.rs index 2cd4ca44..1932d03c 100644 --- a/primitives/src/trie/mpt.rs +++ b/primitives/src/trie/mpt.rs @@ -15,7 +15,12 @@ extern crate alloc; use alloc::boxed::Box; -use core::{cell::RefCell, cmp, fmt::Debug, iter, mem}; +use core::{ + cell::RefCell, + cmp, + fmt::{Debug, Write}, + iter, mem, +}; use alloy_primitives::B256; use alloy_rlp::Encodable; @@ -700,7 +705,12 @@ impl MptNode { /// This method is primarily used for debugging purposes, providing a visual /// representation of the trie's structure. pub fn debug_rlp(&self) -> Vec { - let nibs: String = self.nibs().iter().map(|n| format!("{:x}", n)).collect(); + // convert the nibs to hex + let nibs: String = self.nibs().iter().fold(String::new(), |mut output, n| { + let _ = write!(output, "{:x}", n); + output + }); + match self.as_data() { MptNodeData::Null => vec![format!("{:?}", MptNodeData::Null)], MptNodeData::Branch(children) => children