diff --git a/src/lib.rs b/src/lib.rs index fbca929..3422a45 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -148,10 +148,10 @@ where let leaves_len = self.leaves().len(); match self.namespace_ranges.entry(namespace) { - crate::maybestd::hash_or_btree_map::Entry::Occupied(entry) => { + hash_or_btree_map::Entry::Occupied(entry) => { entry.into_mut().end = leaves_len; } - crate::maybestd::hash_or_btree_map::Entry::Vacant(entry) => { + hash_or_btree_map::Entry::Vacant(entry) => { entry.insert(leaves_len - 1..leaves_len); } } @@ -566,7 +566,7 @@ mod tests { let res = tree.check_range_proof(&root, &leaf_hashes, proof.siblings(), j); if i != j { assert!(res.is_ok()); - assert!(res.unwrap() == RangeProofType::Complete) + assert_eq!(res.unwrap(), RangeProofType::Complete) } else { // Cannot prove the empty range! assert!(res.is_err()) diff --git a/src/namespaced_hash.rs b/src/namespaced_hash.rs index da90144..d8b6b78 100644 --- a/src/namespaced_hash.rs +++ b/src/namespaced_hash.rs @@ -60,7 +60,7 @@ impl Default for NamespacedSha2Hasher { } } -/// An extension of [`MerkleHash`] indicating the the hasher is namespace aware. This allows for the creation of +/// An extension of [`MerkleHash`] indicating the hasher is namespace aware. This allows for the creation of /// namespaced merkle trees and namespaced merkle proofs. pub trait NamespaceMerkleHasher: MerkleHash { /// Create a new hasher which ignores the max namespace diff --git a/src/nmt_proof.rs b/src/nmt_proof.rs index dcf76f7..3ce8fb7 100644 --- a/src/nmt_proof.rs +++ b/src/nmt_proof.rs @@ -29,7 +29,7 @@ pub enum NamespaceProof { proof: Proof, /// Whether to treat the maximum possible namespace as a special marker value and ignore it in computing namespace ranges ignore_max_ns: bool, - /// A leaf that *is* present in the tree, if the namespce being proven absent falls within + /// A leaf that *is* present in the tree, if the namesapce being proven absent falls within /// the namespace range covered by the root. leaf: Option>, }, diff --git a/src/simple_merkle/db.rs b/src/simple_merkle/db.rs index 5729cbf..7b94438 100644 --- a/src/simple_merkle/db.rs +++ b/src/simple_merkle/db.rs @@ -89,7 +89,7 @@ impl< pub enum Node { /// A leaf node contains raw data Leaf(Vec), - /// An inner node is the concatention of two child nodes + /// An inner node is the concatenation of two child nodes Inner(H, H), } diff --git a/src/simple_merkle/tree.rs b/src/simple_merkle/tree.rs index fae4536..6240fcb 100644 --- a/src/simple_merkle/tree.rs +++ b/src/simple_merkle/tree.rs @@ -7,11 +7,11 @@ use crate::maybestd::{boxed::Box, fmt::Debug, hash::Hash, ops::Range, vec::Vec}; /// Manually implement the method we need from #[feature(slice_take)] to /// allow building with stable; trait TakeLast { - fn slice_take_last<'a>(self: &mut &'a Self) -> Option<&'a T>; + fn slice_take_last(self: &mut &Self) -> Option<&T>; } impl TakeLast for [T] { - fn slice_take_last<'a>(self: &mut &'a Self) -> Option<&'a T> { + fn slice_take_last(self: &mut &Self) -> Option<&T> { let (last, rem) = self.split_last()?; *self = rem; Some(last) @@ -20,7 +20,7 @@ impl TakeLast for [T] { type BoxedVisitor = Box::Output)>; -/// Implments an RFC 6962 compatible merkle tree over an in-memory data store which maps preimages to hashes. +/// Implements an RFC 6962 compatible merkle tree over an in-memory data store which maps preimages to hashes. pub struct MerkleTree where M: MerkleHash, @@ -196,7 +196,7 @@ where // We're now done with the left subtrie if range_to_prove.start >= split_point { out.push(l.clone()) - // If the range of nodes to prove completely contains the left subtrie, then we don't need to recurse. + // If the range of nodes to prove completely contains the left subtrie, then we don't need to recurse. } else if range_to_prove.start > subtrie_range.start || range_to_prove.end < split_point { diff --git a/src/simple_merkle/utils.rs b/src/simple_merkle/utils.rs index 52d0879..cd4dd9e 100644 --- a/src/simple_merkle/utils.rs +++ b/src/simple_merkle/utils.rs @@ -33,7 +33,7 @@ pub fn compute_tree_size( remaining_right_siblings -= 1; } mask <<= 1; - // Ensure that the next iteration won't overflow on 32 bit platforms + // Ensure that the next iteration won't overflow on 32-bit platforms if index_of_final_node == u32::MAX as usize { return Err(RangeProofError::TreeTooLarge); }