From 6b40932b1c96a05d25e6d378035c14eac9a0d7b3 Mon Sep 17 00:00:00 2001 From: limbooverlambda Date: Sat, 10 Aug 2024 16:02:07 -0700 Subject: [PATCH] moving the region and store lookup inside the loop and removing the clippy fix from Makefile Signed-off-by: limbooverlambda --- Makefile | 2 +- src/proto.rs | 1 + src/raw/client.rs | 18 +++++++++--------- src/transaction/client.rs | 2 +- src/transaction/requests.rs | 1 - 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 2a52fab3..aef0ad45 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ generate: check: generate cargo check --all --all-targets --features "${ALL_FEATURES}" cargo fmt -- --check - cargo clippy --fix --allow-dirty --all-targets --features "${ALL_FEATURES}" -- -D clippy::all + cargo clippy --all-targets --features "${ALL_FEATURES}" -- -D clippy::all unit-test: generate cargo nextest run --all --no-default-features diff --git a/src/proto.rs b/src/proto.rs index 30f699f9..c86a819a 100644 --- a/src/proto.rs +++ b/src/proto.rs @@ -5,6 +5,7 @@ pub use protos::*; +#[allow(clippy::doc_lazy_continuation)] mod protos { include!("generated/mod.rs"); } diff --git a/src/raw/client.rs b/src/raw/client.rs index d535cf5c..e5a996ab 100644 --- a/src/raw/client.rs +++ b/src/raw/client.rs @@ -806,16 +806,16 @@ impl Client { ) -> Result<(Option, Key)> { let start_key = scan_args.start_key; - let region = self.rpc.clone().region_for_key(&start_key).await?; - let store = self.rpc.clone().store_for_id(region.id()).await?; - let request = new_raw_scan_request( - scan_args.range.clone(), - scan_args.limit, - scan_args.key_only, - scan_args.reverse, - self.cf.clone(), - ); loop { + let region = self.rpc.clone().region_for_key(&start_key).await?; + let store = self.rpc.clone().store_for_id(region.id()).await?; + let request = new_raw_scan_request( + scan_args.range.clone(), + scan_args.limit, + scan_args.key_only, + scan_args.reverse, + self.cf.clone(), + ); let resp = self.do_store_scan(store.clone(), request.clone()).await; return match resp { Ok(mut r) => { diff --git a/src/transaction/client.rs b/src/transaction/client.rs index 16d5c4f6..f3ea884c 100644 --- a/src/transaction/client.rs +++ b/src/transaction/client.rs @@ -42,7 +42,7 @@ const SCAN_LOCK_BATCH_SIZE: u32 = 1024; /// - `gc`: trigger a GC process which clears stale data in the cluster. /// - `current_timestamp`: get the current `Timestamp` from PD. /// - `snapshot`: get a [`Snapshot`] of the database at a specified timestamp. -/// A `Snapshot` is a read-only transaction. +/// A `Snapshot` is a read-only transaction. /// /// The returned results of transactional requests are [`Future`](std::future::Future)s that must be /// awaited to execute. diff --git a/src/transaction/requests.rs b/src/transaction/requests.rs index 231c9e5a..6a5538d9 100644 --- a/src/transaction/requests.rs +++ b/src/transaction/requests.rs @@ -904,7 +904,6 @@ impl Merge for Collect { } #[cfg(test)] -#[cfg_attr(feature = "protobuf-codec", allow(clippy::useless_conversion))] mod tests { use crate::common::Error::PessimisticLockError; use crate::common::Error::ResolveLockError;