Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Robin's suggested changes for #6

Co-authored-by: Robin Salen <[email protected]>
  • Loading branch information
BGluth and Nashtare authored Feb 2, 2024
1 parent 41780f3 commit 91f3794
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/debug_tools/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ impl PathSegment {
match self {
PathSegment::Empty | PathSegment::Hash => None,
PathSegment::Branch(nib) => Some(Nibbles::from_nibble(*nib)),
PathSegment::Extension(nibs) => Some(*nibs),
PathSegment::Leaf(nibs) => Some(*nibs),
PathSegment::Extension(nibs) | PathSegment::Leaf(nibs) => Some(*nibs),
}
}
}
Expand All @@ -65,8 +64,7 @@ pub(super) fn get_key_piece_from_node<T: PartialTrie>(n: &Node<T>, curr_key: &Ni
match n {
Node::Empty | Node::Hash(_) => Nibbles::default(),
Node::Branch { .. } => curr_key.get_next_nibbles(1),
Node::Extension { nibbles, child: _ } => *nibbles,
Node::Leaf { nibbles, value: _ } => *nibbles,
Node::Extension { nibbles, child: _ } | Node::Leaf { nibbles, value: _ } => *nibbles,
}
}

Expand All @@ -75,8 +73,7 @@ pub(super) fn get_key_piece_from_node<T: PartialTrie>(n: &Node<T>, curr_key: &Ni
pub(super) fn get_key_piece_from_node_no_branch_key<T: PartialTrie>(n: &Node<T>) -> Nibbles {
match n {
Node::Empty | Node::Hash(_) | Node::Branch { .. } => Nibbles::default(),
Node::Extension { nibbles, child: _ } => *nibbles,
Node::Leaf { nibbles, value: _ } => *nibbles,
Node::Extension { nibbles, child: _ } | Node::Leaf { nibbles, value: _ } => *nibbles,
}
}

Expand Down

0 comments on commit 91f3794

Please sign in to comment.