it's ugly but it works

This commit is contained in:
jfmonty2 committed 2022-12-05 20:12:57 -08:00
1 parent a10ff091da
commit 3b9a3eed0c
3 files changed
+114 -29

No files matched your search

+4 -8
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);
}
}