arnaucube
arnaucube/miden-cryptoPublic Self-hosted repository
chore: fix lints
Bobbin Threadbare bobbinth@protonmail.com
Tue, 06 Aug 2024 16:52:46 -0700
commit

dfdd5f722f8df5c322922fa689615882f9e8ab55

parent

9f63b505102a1852b5d0b625655b817b839ce83f

2 files changed, 4 insertions(+), 7 deletions(-)

jump to
M src/merkle/partial_mt/mod.rs → src/merkle/partial_mt/mod.rs

@@ -214,7 +214,7 @@ ///

/// # Errors /// Returns an error if: /// - the specified index has depth set to 0 or the depth is greater than the depth of this - /// Merkle tree. + /// Merkle tree. /// - the specified index is not contained in the nodes map. pub fn get_path(&self, mut index: NodeIndex) -> Result<MerklePath, MerkleError> { if index.is_root() {
M src/utils/kv_map.rs → src/utils/kv_map.rs

@@ -126,11 +126,10 @@ /// Returns a reference to the value associated with the given key if the value exists.

/// /// If the key is part of the initial data set, the key access is recorded. fn get(&self, key: &K) -> Option<&V> { - self.data.get(key).map(|value| { + self.data.get(key).inspect(|&value| { if !self.updates.contains(key) { self.trace.borrow_mut().insert(key.clone(), value.clone()); } - value }) }

@@ -155,11 +154,10 @@ /// If the key already exists in the data set, the value is updated and the old value is

/// returned. fn insert(&mut self, key: K, value: V) -> Option<V> { let new_update = self.updates.insert(key.clone()); - self.data.insert(key.clone(), value).map(|old_value| { + self.data.insert(key.clone(), value).inspect(|old_value| { if new_update { self.trace.borrow_mut().insert(key, old_value.clone()); } - old_value }) }

@@ -167,12 +165,11 @@ /// Removes a key-value pair from the data set.

/// /// If the key exists in the data set, the old value is returned. fn remove(&mut self, key: &K) -> Option<V> { - self.data.remove(key).map(|old_value| { + self.data.remove(key).inspect(|old_value| { let new_update = self.updates.insert(key.clone()); if new_update { self.trace.borrow_mut().insert(key.clone(), old_value.clone()); } - old_value }) }