config: add rustfmt config

This commit is contained in:
Augusto F. Hack
2023-04-11 17:38:39 +02:00
parent e02507d11e
commit bbb1e641a3
16 changed files with 126 additions and 341 deletions

View File

@@ -184,15 +184,11 @@ impl MerkleStore {
let mut hash: RpoDigest = root.into();
// corner case: check the root is in the store when called with index `NodeIndex::root()`
self.nodes
.get(&hash)
.ok_or(MerkleError::RootNotInStore(hash.into()))?;
self.nodes.get(&hash).ok_or(MerkleError::RootNotInStore(hash.into()))?;
for i in (0..index.depth()).rev() {
let node = self
.nodes
.get(&hash)
.ok_or(MerkleError::NodeNotInStore(hash.into(), index))?;
let node =
self.nodes.get(&hash).ok_or(MerkleError::NodeNotInStore(hash.into(), index))?;
let bit = (index.value() >> i) & 1;
hash = if bit == 0 { node.left } else { node.right }
@@ -215,15 +211,11 @@ impl MerkleStore {
let mut path = Vec::with_capacity(index.depth().into());
// corner case: check the root is in the store when called with index `NodeIndex::root()`
self.nodes
.get(&hash)
.ok_or(MerkleError::RootNotInStore(hash.into()))?;
self.nodes.get(&hash).ok_or(MerkleError::RootNotInStore(hash.into()))?;
for i in (0..index.depth()).rev() {
let node = self
.nodes
.get(&hash)
.ok_or(MerkleError::NodeNotInStore(hash.into(), index))?;
let node =
self.nodes.get(&hash).ok_or(MerkleError::NodeNotInStore(hash.into(), index))?;
let bit = (index.value() >> i) & 1;
hash = if bit == 0 {
@@ -302,11 +294,7 @@ impl MerkleStore {
};
// traverse down
hash = if path & 1 == 0 {
children.left
} else {
children.right
};
hash = if path & 1 == 0 { children.left } else { children.right };
path >>= 1;
}