Skip to content

Commit

Permalink
fix clippy error for rust 1.78
Browse files Browse the repository at this point in the history
Signed-off-by: Ping Yu <yuping@pingcap.com>
  • Loading branch information
pingyu committed Jun 1, 2024
1 parent c6110dd commit 70fe64e
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 23 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ check: generate
cargo fmt -- --check
cargo clippy --all-targets --features "${ALL_FEATURES}" -- -D clippy::all

clippy:
cargo clippy --all-targets --features "${ALL_FEATURES}" -- -D clippy::all

unit-test: generate
cargo nextest run --all --no-default-features

Expand Down
4 changes: 2 additions & 2 deletions src/pd/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl Cluster {
timeout: Duration,
) -> Result<pdpb::GetRegionResponse> {
let mut req = pd_request!(self.id, pdpb::GetRegionRequest);
req.region_key = key.clone();
req.region_key = key;
req.send(&mut self.client, timeout).await
}

Expand Down Expand Up @@ -101,7 +101,7 @@ impl Cluster {
timeout: Duration,
) -> Result<keyspacepb::KeyspaceMeta> {
let mut req = pd_request!(self.id, keyspacepb::LoadKeyspaceRequest);
req.name = keyspace.to_owned();
req.name = keyspace.to_string();
let resp = req.send(&mut self.keyspace_client, timeout).await?;
let keyspace = resp
.keyspace
Expand Down
2 changes: 1 addition & 1 deletion src/raw/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ impl Shardable for RawCoprocessorRequest {

fn apply_shard(&mut self, shard: Self::Shard, store: &RegionStore) -> Result<()> {
self.set_leader(&store.region_with_leader)?;
self.inner.ranges = shard.clone();
self.inner.ranges.clone_from(&shard);
self.inner.data = (self.data_builder)(store.region_with_leader.region.clone(), shard);
Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions src/region_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,10 @@ mod test {
});
assert!(!is_valid_tikv_store(&store));

store.labels[1].value = "tiflash_compute".to_owned();
store.labels[1].value = "tiflash_compute".to_string();
assert!(!is_valid_tikv_store(&store));

store.labels[1].value = "other".to_owned();
store.labels[1].value = "other".to_string();
assert!(is_valid_tikv_store(&store));
}
}
16 changes: 0 additions & 16 deletions src/store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use std::cmp::max;
use std::cmp::min;
use std::sync::Arc;

use async_trait::async_trait;
use derive_new::new;
use futures::prelude::*;
use futures::stream::BoxStream;
Expand Down Expand Up @@ -38,21 +37,6 @@ pub struct Store {
pub client: Arc<dyn KvClient + Send + Sync>,
}

#[async_trait]
pub trait KvConnectStore: KvConnect {
async fn connect_to_store(
&self,
region: RegionWithLeader,
address: String,
) -> Result<RegionStore> {
log::info!("connect to tikv endpoint: {:?}", &address);
let client = self.connect(address.as_str()).await?;
Ok(RegionStore::new(region, Arc::new(client)))
}
}

impl KvConnectStore for TikvConnect {}

/// Maps keys to a stream of stores. `key_data` must be sorted in increasing order
pub fn store_stream_for_keys<K, KOut, PdC>(
key_data: impl Iterator<Item = K> + Send + Sync + 'static,
Expand Down
4 changes: 2 additions & 2 deletions src/transaction/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,13 +358,13 @@ impl BufferEntry {
BufferEntry::Cached(_) => return None,
BufferEntry::Put(v) => {
pb.op = kvrpcpb::Op::Put.into();
pb.value = v.clone();
pb.value.clone_from(v);
}
BufferEntry::Del => pb.op = kvrpcpb::Op::Del.into(),
BufferEntry::Locked(_) => pb.op = kvrpcpb::Op::Lock.into(),
BufferEntry::Insert(v) => {
pb.op = kvrpcpb::Op::Insert.into();
pb.value = v.clone();
pb.value.clone_from(v);
}
BufferEntry::CheckNotExist => pb.op = kvrpcpb::Op::CheckNotExists.into(),
};
Expand Down

0 comments on commit 70fe64e

Please sign in to comment.