From 6d92a1e08bc68648a168b1f807c9d036124dc252 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Fri, 18 Oct 2024 13:41:55 -0400 Subject: [PATCH] clippy --- crates/chia-datalayer/src/merkle.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/crates/chia-datalayer/src/merkle.rs b/crates/chia-datalayer/src/merkle.rs index 57dd2f2c..d253ac47 100644 --- a/crates/chia-datalayer/src/merkle.rs +++ b/crates/chia-datalayer/src/merkle.rs @@ -1099,7 +1099,7 @@ impl MerkleBlob { let slice = unsafe { std::slice::from_raw_parts(blob.buf_ptr() as *const u8, blob.len_bytes()) }; - Self::new(Vec::from(slice)).map_err(|e| PyValueError::new_err(e)) + Self::new(Vec::from(slice)).map_err(PyValueError::new_err) } #[pyo3(name = "insert", signature = (key, value, hash, reference_kid = None, side = None))] @@ -1133,33 +1133,29 @@ impl MerkleBlob { } }; self.insert(key, value, &hash, insert_location) - .map_err(|e| PyValueError::new_err(e)) + .map_err(PyValueError::new_err) } #[pyo3(name = "delete")] pub fn py_delete(&mut self, key: KvId) -> PyResult<()> { - self.delete(key).map_err(|e| PyValueError::new_err(e)) + self.delete(key).map_err(PyValueError::new_err) } #[pyo3(name = "get_raw_node")] pub fn py_get_raw_node(&mut self, index: TreeIndex) -> PyResult { - self.get_node(index).map_err(|e| PyValueError::new_err(e)) + self.get_node(index).map_err(PyValueError::new_err) } #[pyo3(name = "calculate_lazy_hashes")] pub fn py_calculate_lazy_hashes(&mut self) -> PyResult<()> { - self.calculate_lazy_hashes() - .map_err(|e| PyValueError::new_err(e)) + self.calculate_lazy_hashes().map_err(PyValueError::new_err) } #[pyo3(name = "get_lineage")] pub fn py_get_lineage(&self, index: TreeIndex, py: Python<'_>) -> PyResult { let list = pyo3::types::PyList::empty_bound(py); - for node in self - .get_lineage(index) - .map_err(|e| PyValueError::new_err(e))? - { + for node in self.get_lineage(index).map_err(PyValueError::new_err)? { use pyo3::conversion::IntoPy; use pyo3::types::PyListMethods; list.append(node.into_py(py))?;