From d99bb7e64e7d2131be832b61831eaffa277f84aa Mon Sep 17 00:00:00 2001 From: bsbds <69835502+bsbds@users.noreply.github.com> Date: Thu, 16 May 2024 10:08:23 +0800 Subject: [PATCH] chore: clippy kv_store --- crates/xline/src/storage/kv_store.rs | 9 ++++----- crates/xline/src/storage/lease_store/mod.rs | 12 +++--------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/crates/xline/src/storage/kv_store.rs b/crates/xline/src/storage/kv_store.rs index ea9e5f599..ee4c2084a 100644 --- a/crates/xline/src/storage/kv_store.rs +++ b/crates/xline/src/storage/kv_store.rs @@ -593,7 +593,7 @@ impl KvStore { // As we store use revision as key in the DB storage, // a fake revision needs to be used during speculative execution let fake_revision = i64::MAX; - self.execute_txn(&txn_db, index, req, fake_revision, &mut 0) + self.execute_txn(txn_db, index, req, fake_revision, &mut 0) .map(Into::into)? } RequestWrapper::CompactionRequest(ref req) => { @@ -720,7 +720,7 @@ impl KvStore { fn execute_txn_put( &self, txn_db: &Transaction, - index: &mut dyn IndexOperate, + index: &dyn IndexOperate, req: &PutRequest, revision: i64, sub_revision: &mut i64, @@ -801,7 +801,7 @@ impl KvStore { fn execute_txn_delete_range( &self, txn_db: &T, - index: &mut dyn IndexOperate, + index: &dyn IndexOperate, req: &DeleteRangeRequest, revision: i64, sub_revision: &mut i64, @@ -1109,8 +1109,7 @@ impl KvStore { succeeded: success, responses: resps .into_iter() - .map(Option::into_iter) - .flatten() + .flat_map(Option::into_iter) .map(Into::into) .collect(), } diff --git a/crates/xline/src/storage/lease_store/mod.rs b/crates/xline/src/storage/lease_store/mod.rs index 2b15ac220..af2ee173d 100644 --- a/crates/xline/src/storage/lease_store/mod.rs +++ b/crates/xline/src/storage/lease_store/mod.rs @@ -352,17 +352,11 @@ impl LeaseStore { } let txn_db = self.db.transaction(); - let mut txn_index = self.index.state(); + let txn_index = self.index.state(); for (key, mut sub_revision) in del_keys.iter().zip(0..) { - let deleted = KvStore::delete_keys( - &txn_db, - &mut txn_index, - key, - &[], - revision, - &mut sub_revision, - )?; + let deleted = + KvStore::delete_keys(&txn_db, &txn_index, key, &[], revision, &mut sub_revision)?; KvStore::detach_leases(&deleted, &self.lease_collection); let mut del_event = KvStore::new_deletion_events(revision, deleted); updates.append(&mut del_event);