Skip to content

Commit

Permalink
cargo clippy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKitsune committed Nov 2, 2023
1 parent 52d67b0 commit 5d20fcc
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions crates/tree_availability/src/world_tree/tree_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,8 @@ impl TreeData {
let tree = self.tree.read().await;

// If the root is not specified, use the latest root
if root.is_none() {
Some(InclusionProof::new(
tree.root(),
Self::proof(&tree, identity)?,
None,
))
} else {
let root = root.unwrap();

if let Some(root) = root {
// If the root is the latest root, use the current version of the tree
if root == tree.root() {
return Some(InclusionProof::new(
Expand All @@ -116,7 +109,7 @@ impl TreeData {
));
} else {
let tree_history = self.tree_history.read().await;
// // Otherwise, search the tree history for the root and use the corresponding tree
// Otherwise, search the tree history for the root and use the corresponding tree
for prev_tree in tree_history.iter() {
if prev_tree.root() == root {
return Some(InclusionProof::new(
Expand All @@ -129,6 +122,12 @@ impl TreeData {
}

None
} else {
Some(InclusionProof::new(
tree.root(),
Self::proof(&tree, identity)?,
None,
))
}
}

Expand Down

0 comments on commit 5d20fcc

Please sign in to comment.