diff --git a/zcash_history/src/entry.rs b/zcash_history/src/entry.rs index bfd4d178d..310382b04 100644 --- a/zcash_history/src/entry.rs +++ b/zcash_history/src/entry.rs @@ -34,11 +34,7 @@ impl Entry { /// Is this node a leaf. pub fn leaf(&self) -> bool { - if let EntryKind::Leaf = self.kind { - true - } else { - false - } + matches!(self.kind, EntryKind::Leaf) } /// Left child diff --git a/zcash_history/src/tree.rs b/zcash_history/src/tree.rs index 0d3f16071..00615ed98 100644 --- a/zcash_history/src/tree.rs +++ b/zcash_history/src/tree.rs @@ -648,7 +648,7 @@ mod tests { tree.truncate_leaf().expect("Failed to truncate"); } - TestResult::from_bool(if let EntryLink::Stored(2) = tree.root() { true } else { false }) + TestResult::from_bool(matches!(tree.root(), EntryLink::Stored(2))) } } @@ -678,12 +678,9 @@ mod tests { TestResult::from_bool( if number & (number - 1) == 0 { - if let EntryLink::Stored(_) = tree.root() { true } - else { false } - } else if let EntryLink::Generated(_) = tree.root() { - true + matches!(tree.root(), EntryLink::Stored(_)) } else { - false + matches!(tree.root(), EntryLink::Generated(_)) } ) } @@ -707,12 +704,9 @@ mod tests { TestResult::from_bool( if total & (total - 1) == 0 { - if let EntryLink::Stored(_) = tree.root() { true } - else { false } - } else if let EntryLink::Generated(_) = tree.root() { - true + matches!(tree.root(), EntryLink::Stored(_)) } else { - false + matches!(tree.root(), EntryLink::Generated(_)) } ) }