Skip to content

Commit

Permalink
fix clippy (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wollac authored Oct 19, 2023
1 parent 4db793c commit 2f12782
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions primitives/src/trie/mpt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<T: alloy_rlp::Decodable + Debug>(&self) -> Vec<String> {
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
Expand Down

0 comments on commit 2f12782

Please sign in to comment.