Skip to content

Commit

Permalink
complex match -> simple if else if else
Browse files Browse the repository at this point in the history
  • Loading branch information
altendky committed Nov 5, 2024
1 parent 0e5f879 commit f5ee0c8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions crates/chia-datalayer/src/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,12 @@ impl NodeSpecific {
panic!("unable to get sibling index from a leaf")
};

match index {
x if (x == *right) => *left,
x if (x == *left) => *right,
_ => panic!("index not a child: {index}"),
if index == *right {
*left
} else if index == *left {
*right
} else {
panic!("index not a child: {index}")
}
}
}
Expand Down

0 comments on commit f5ee0c8

Please sign in to comment.