Skip to content

Commit

Permalink
chore: fix clippy error for rust 1.78 (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
pingyu committed Jun 2, 2024
1 parent c6110dd commit 0db723f
Show file tree
Hide file tree
Showing 41 changed files with 43 additions and 23 deletions.
1 change: 1 addition & 0 deletions src/generated/autoid.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AutoIdRequest {
Expand Down
1 change: 1 addition & 0 deletions src/generated/backup.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// The message save the metadata of a backup.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down
1 change: 1 addition & 0 deletions src/generated/cdcpb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Header {
Expand Down
1 change: 1 addition & 0 deletions src/generated/configpb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Status {
Expand Down
1 change: 1 addition & 0 deletions src/generated/coprocessor.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// \[start, end)
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down
1 change: 1 addition & 0 deletions src/generated/deadlock.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WaitForEntriesRequest {}
Expand Down
1 change: 1 addition & 0 deletions src/generated/debugpb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetRequest {
Expand Down
1 change: 1 addition & 0 deletions src/generated/diagnosticspb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchLogRequest {
Expand Down
1 change: 1 addition & 0 deletions src/generated/disaggregated.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct S3LockResult {
Expand Down
1 change: 1 addition & 0 deletions src/generated/disk_usage.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum DiskUsage {
Expand Down
1 change: 1 addition & 0 deletions src/generated/encryptionpb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// General encryption metadata for any data type.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down
1 change: 1 addition & 0 deletions src/generated/enginepb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommandRequestHeader {
Expand Down
1 change: 1 addition & 0 deletions src/generated/eraftpb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// The entry is a type of change that needs to be applied. It contains two data fields.
/// While the fields are built into the model; their usage is determined by the entry_type.
///
Expand Down
1 change: 1 addition & 0 deletions src/generated/errorpb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// NotLeader is the error variant that tells a request be handle by raft leader
/// is sent to raft follower or learner.
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down
1 change: 1 addition & 0 deletions src/generated/gcpb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestHeader {
Expand Down
1 change: 1 addition & 0 deletions src/generated/google.api.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// Defines the HTTP configuration for an API service. It contains a list of
/// \[HttpRule\]\[google.api.HttpRule\], each specifying the mapping of an RPC method
/// to one or more HTTP REST API methods.
Expand Down
1 change: 1 addition & 0 deletions src/generated/import_kvpb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SwitchModeRequest {
Expand Down
1 change: 1 addition & 0 deletions src/generated/import_sstpb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SuspendImportRpcRequest {
Expand Down
1 change: 1 addition & 0 deletions src/generated/keyspacepb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct KeyspaceMeta {
Expand Down
1 change: 1 addition & 0 deletions src/generated/kvrpcpb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// A transactional get command. Lookup a value for `key` in the transaction with
/// starting timestamp = `version`.
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down
1 change: 1 addition & 0 deletions src/generated/logbackup.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// The minimal information for identify a region.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down
1 change: 1 addition & 0 deletions src/generated/meta_storagepb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Error {
Expand Down
1 change: 1 addition & 0 deletions src/generated/metapb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Cluster {
Expand Down
1 change: 1 addition & 0 deletions src/generated/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
pub mod autoid {
include!("autoid.rs");
}
Expand Down
1 change: 1 addition & 0 deletions src/generated/mpp.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// TaskMeta contains meta of a mpp plan, including query's ts and task address.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down
1 change: 1 addition & 0 deletions src/generated/pdpb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WatchGlobalConfigRequest {
Expand Down
1 change: 1 addition & 0 deletions src/generated/raft_cmdpb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetRequest {
Expand Down
1 change: 1 addition & 0 deletions src/generated/raft_serverpb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RaftMessage {
Expand Down
1 change: 1 addition & 0 deletions src/generated/recover_data.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// request to read region meata from a store
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down
1 change: 1 addition & 0 deletions src/generated/replication_modepb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
/// The replication status sync from PD to TiKV.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down
1 change: 1 addition & 0 deletions src/generated/resource_manager.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListResourceGroupsRequest {}
Expand Down
1 change: 1 addition & 0 deletions src/generated/resource_usage_agent.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResourceMeteringRequest {}
Expand Down
1 change: 1 addition & 0 deletions src/generated/schedulingpb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestHeader {
Expand Down
1 change: 1 addition & 0 deletions src/generated/tikvpb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchCommandsRequest {
Expand Down
1 change: 1 addition & 0 deletions src/generated/tracepb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TraceRecordRequest {}
Expand Down
1 change: 1 addition & 0 deletions src/generated/tsopb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestHeader {
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 0db723f

Please sign in to comment.