it's ugly but it works

This commit is contained in:
2022-12-05 20:12:57 -08:00
parent a10ff091da
commit 3b9a3eed0c
3 changed files with 114 additions and 29 deletions

View File

@ -91,14 +91,10 @@ fn explode(node: &mut Node, depth: usize) -> Option<(u8, u8)> {
if let Leaf(_) = node {return None;}
if depth >= 4 {
let (left, right) = node.unwrap_branch();
match (left, right) {
(Leaf(v1), Leaf(v2)) => {
let result = (*v1, *v2);
*node = Leaf(0);
return Some(result);
},
_ => (),
if let (Leaf(v1), Leaf(v2)) = node.unwrap_branch() {
let result = (*v1, *v2);
*node = Leaf(0);
return Some(result);
}
}