From 1fa58e5a3d3fe63379b8b3bff3fbfeb0ee18c735 Mon Sep 17 00:00:00 2001 From: bsbds <69835502+bsbds@users.noreply.github.com> Date: Tue, 9 Apr 2024 10:45:54 +0800 Subject: [PATCH] chore: fix clippy Signed-off-by: bsbds <69835502+bsbds@users.noreply.github.com> --- crates/engine/src/rocksdb_engine/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/rocksdb_engine/mod.rs b/crates/engine/src/rocksdb_engine/mod.rs index 00e947b70..bbfae9ce2 100644 --- a/crates/engine/src/rocksdb_engine/mod.rs +++ b/crates/engine/src/rocksdb_engine/mod.rs @@ -114,6 +114,7 @@ impl RocksEngine { /// Gets the max write data size. /// Max write data size = 2 * key + value + `cf_handle_size` + `ESTIMATE_WRITTEN_SIZE_OFFSET` pub(super) fn max_write_size(table_len: usize, key_len: usize, value_len: usize) -> usize { + /// Estimate size offset for a write operation const ESTIMATE_WRITTEN_SIZE_OFFSET: usize = 1008; key_len .overflow_mul(2) @@ -201,7 +202,6 @@ impl StorageEngine for RocksEngine { fn write_batch(&self, wr_ops: Vec>, _sync: bool) -> Result<(), EngineError> { let transaction = self.inner.transaction(); let mut size = 0; - #[allow(clippy::pattern_type_mismatch)] // can't be fixed for op in wr_ops { match op { WriteOperation::Put { table, key, value } => { @@ -231,7 +231,7 @@ impl StorageEngine for RocksEngine { let mode = IteratorMode::From(from, Direction::Forward); let kvs: Vec<_> = transaction .iterator_cf(&cf, mode) - .take_while(|res| res.as_ref().is_ok_and(|(key, _)| key.as_ref() < to)) + .take_while(|res| res.as_ref().is_ok_and(|kv| kv.0.as_ref() < to)) .collect::, _>>()?; for (key, _) in kvs { transaction.delete_cf(&cf, key)?;