diff --git a/src/kv/key.rs b/src/kv/key.rs index 8ca48829..fa19d3f6 100644 --- a/src/kv/key.rs +++ b/src/kv/key.rs @@ -90,7 +90,7 @@ impl AsRef for KvPairTTL { impl From for (KvPair, u64) { fn from(value: KvPairTTL) -> Self { - (value.0.clone(), value.1) + (value.0, value.1) } } diff --git a/src/raw/requests.rs b/src/raw/requests.rs index 63389f2d..a349fe86 100644 --- a/src/raw/requests.rs +++ b/src/raw/requests.rs @@ -7,7 +7,6 @@ use std::time::Duration; use async_trait::async_trait; use futures::stream::BoxStream; -use futures::StreamExt; use tonic::transport::Channel; @@ -202,12 +201,12 @@ impl Shardable for kvrpcpb::RawBatchPutRequest { let kvs = self.pairs.clone(); let ttls = self.ttls.clone(); let mut kv_ttl: Vec = kvs - .iter() + .into_iter() .zip(ttls) - .map(|(kv, ttl)| KvPairTTL(kv.clone(), ttl)) + .map(|(kv, ttl)| KvPairTTL(kv, ttl)) .collect(); kv_ttl.sort_by(|a, b| a.0.key.clone().cmp(&b.0.key)); - store_stream_for_keys(kv_ttl.into_iter(), pd_client.clone()).boxed() + store_stream_for_keys(kv_ttl.into_iter(), pd_client.clone()) } fn apply_shard(&mut self, shard: Self::Shard, store: &RegionStore) -> Result<()> { @@ -672,8 +671,7 @@ mod test { .retry_multi_region(DEFAULT_REGION_BACKOFF) .plan(); let _ = plan.execute().await; - assert_eq!(actual_map.lock().unwrap().len(), 2); - assert_eq!(actual_map.lock().unwrap().deref().clone(), expected_map); + assert_eq!(actual_map.lock().unwrap().deref(), &expected_map); Ok(()) } } diff --git a/src/store/mod.rs b/src/store/mod.rs index b8381de3..f21373b4 100644 --- a/src/store/mod.rs +++ b/src/store/mod.rs @@ -36,7 +36,7 @@ pub struct RegionStore { pub struct Store { pub client: Arc, } -#[allow(dead_code)] + /// Maps keys to a stream of stores. `key_data` must be sorted in increasing order pub fn store_stream_for_keys( key_data: impl Iterator + Send + Sync + 'static,