mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-08 22:33:22 +00:00
fix:Apply suggestions from clippy 1.88
This commit is contained in:
@@ -394,7 +394,7 @@ pub async fn check_replicate_delete(
|
||||
// use crate::global::*;
|
||||
|
||||
fn target_reset_header(arn: &str) -> String {
|
||||
format!("{}{}-{}", RESERVED_METADATA_PREFIX_LOWER, REPLICATION_RESET, arn)
|
||||
format!("{RESERVED_METADATA_PREFIX_LOWER}{REPLICATION_RESET}-{arn}")
|
||||
}
|
||||
|
||||
pub async fn get_heal_replicate_object_info(
|
||||
@@ -491,7 +491,7 @@ pub async fn get_heal_replicate_object_info(
|
||||
|
||||
let asz = oi.get_actual_size().unwrap_or(0);
|
||||
|
||||
let key = format!("{}{}", RESERVED_METADATA_PREFIX_LOWER, REPLICATION_TIMESTAMP);
|
||||
let key = format!("{RESERVED_METADATA_PREFIX_LOWER}{REPLICATION_TIMESTAMP}");
|
||||
let tm: Option<DateTime<Utc>> = user_defined
|
||||
.get(&key)
|
||||
.and_then(|v| DateTime::parse_from_rfc3339(v).ok())
|
||||
@@ -819,7 +819,7 @@ impl ReplicationPool {
|
||||
// }
|
||||
|
||||
fn get_worker_ch(&self, bucket: &str, object: &str, _sz: i64) -> Option<&Sender<Box<dyn ReplicationWorkerOperation>>> {
|
||||
let h = xxh3_64(format!("{}{}", bucket, object).as_bytes()); // 计算哈希值
|
||||
let h = xxh3_64(format!("{bucket}{object}").as_bytes()); // 计算哈希值
|
||||
|
||||
// need lock;
|
||||
let workers = &self.workers_sender; // 读锁
|
||||
@@ -1067,7 +1067,7 @@ impl fmt::Display for VersionPurgeStatusType {
|
||||
VersionPurgeStatusType::Empty => "",
|
||||
VersionPurgeStatusType::Unknown => "UNKNOWN",
|
||||
};
|
||||
write!(f, "{}", s)
|
||||
write!(f, "{s}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1307,7 +1307,7 @@ impl fmt::Display for ReplicateDecision {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let mut entries = Vec::new();
|
||||
for (key, value) in &self.targets_map {
|
||||
entries.push(format!("{}={}", key, value));
|
||||
entries.push(format!("{key}={value}"));
|
||||
}
|
||||
write!(f, "{}", entries.join(","))
|
||||
}
|
||||
@@ -2123,7 +2123,7 @@ async fn replicate_object_with_multipart(
|
||||
.provider(provider)
|
||||
.secure(false)
|
||||
.build()
|
||||
.map_err(|e| Error::other(format!("build minio client failed: {}", e)))?;
|
||||
.map_err(|e| Error::other(format!("build minio client failed: {e}")))?;
|
||||
|
||||
let ret = minio_cli
|
||||
.create_multipart_upload_with_versionid(tgt_cli.bucket.clone(), local_obj_info.name.clone(), rep_obj.version_id.clone())
|
||||
@@ -2168,7 +2168,7 @@ async fn replicate_object_with_multipart(
|
||||
}
|
||||
Err(err) => {
|
||||
error!("upload part {} failed: {}", index + 1, err);
|
||||
Err(Error::other(format!("upload error: {}", err)))
|
||||
Err(Error::other(format!("upload error: {err}")))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2179,7 +2179,7 @@ async fn replicate_object_with_multipart(
|
||||
},
|
||||
Err(err) => {
|
||||
error!("reader error for part {}: {}", index + 1, err);
|
||||
Err(Error::other(format!("reader error: {}", err)))
|
||||
Err(Error::other(format!("reader error: {err}")))
|
||||
}
|
||||
}
|
||||
}));
|
||||
@@ -2196,7 +2196,7 @@ async fn replicate_object_with_multipart(
|
||||
}
|
||||
Err(join_err) => {
|
||||
error!("tokio join error: {}", join_err);
|
||||
return Err(Error::other(format!("join error: {}", join_err)));
|
||||
return Err(Error::other(format!("join error: {join_err}")));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2210,12 +2210,12 @@ async fn replicate_object_with_multipart(
|
||||
}
|
||||
Err(err) => {
|
||||
error!("finish upload failed:{}", err);
|
||||
return Err(Error::other(format!("finish upload failed:{}", err)));
|
||||
return Err(Error::other(format!("finish upload failed:{err}")));
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
return Err(Error::other(format!("finish upload failed:{}", err)));
|
||||
return Err(Error::other(format!("finish upload failed:{err}")));
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
@@ -2729,7 +2729,7 @@ pub async fn replicate_object(ri: ReplicateObjectInfo, object_api: Arc<store::EC
|
||||
// }
|
||||
}
|
||||
Err(err) => {
|
||||
println!("Failed to get replication config: {:?}", err);
|
||||
println!("Failed to get replication config: {err:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ pub struct BucketRemoteTargetNotFound {
|
||||
}
|
||||
|
||||
pub async fn init_bucket_targets(bucket: &str, meta: Arc<bucket::metadata::BucketMetadata>) {
|
||||
println!("140 {}", bucket);
|
||||
println!("140 {bucket}");
|
||||
if let Some(sys) = GLOBAL_Bucket_Target_Sys.get() {
|
||||
if let Some(tgts) = meta.bucket_target_config.clone() {
|
||||
for tgt in tgts.targets {
|
||||
@@ -282,7 +282,7 @@ impl BucketTargetSys {
|
||||
let _ = metadata_sys::update(bucket, "bucket-targets.json", json).await;
|
||||
}
|
||||
Err(e) => {
|
||||
println!("序列化失败{}", e);
|
||||
println!("序列化失败{e}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,11 +379,11 @@ impl BucketTargetSys {
|
||||
// .get_bucket_info(bucket, &ecstore::store_api::BucketOptions::default()).await;
|
||||
match store.get_bucket_info(_bucket, &store_api::BucketOptions::default()).await {
|
||||
Ok(info) => {
|
||||
println!("Bucket Info: {:?}", info);
|
||||
println!("Bucket Info: {info:?}");
|
||||
info.versionning
|
||||
}
|
||||
Err(err) => {
|
||||
eprintln!("Error: {:?}", err);
|
||||
eprintln!("Error: {err:?}");
|
||||
false
|
||||
}
|
||||
}
|
||||
@@ -433,7 +433,7 @@ impl BucketTargetSys {
|
||||
|
||||
let url_str = format!("http://{}", tgt.endpoint.clone());
|
||||
|
||||
println!("url str is {}", url_str);
|
||||
println!("url str is {url_str}");
|
||||
// 转换为 Url 类型
|
||||
let parsed_url = url::Url::parse(&url_str).unwrap();
|
||||
|
||||
@@ -451,7 +451,7 @@ impl BucketTargetSys {
|
||||
.await
|
||||
{
|
||||
Ok(info) => {
|
||||
println!("Bucket Info: {:?}", info);
|
||||
println!("Bucket Info: {info:?}");
|
||||
if !info.versionning {
|
||||
println!("2222222222 {}", info.versionning);
|
||||
return Err(SetTargetError::TargetNotVersioned(tgt.target_bucket.to_string()));
|
||||
@@ -459,7 +459,7 @@ impl BucketTargetSys {
|
||||
}
|
||||
Err(err) => {
|
||||
println!("remote bucket 369 is:{}", tgt.target_bucket);
|
||||
eprintln!("Error: {:?}", err);
|
||||
eprintln!("Error: {err:?}");
|
||||
return Err(SetTargetError::SourceNotVersioned(tgt.target_bucket.to_string()));
|
||||
}
|
||||
}
|
||||
@@ -629,12 +629,12 @@ impl ARN {
|
||||
pub fn parse(s: &str) -> Result<Self, String> {
|
||||
// ARN 必须是格式 arn:rustfs:<Type>:<REGION>:<ID>:<remote-bucket>
|
||||
if !s.starts_with("arn:rustfs:") {
|
||||
return Err(format!("Invalid ARN {}", s));
|
||||
return Err(format!("Invalid ARN {s}"));
|
||||
}
|
||||
|
||||
let tokens: Vec<&str> = s.split(':').collect();
|
||||
if tokens.len() != 6 || tokens[4].is_empty() || tokens[5].is_empty() {
|
||||
return Err(format!("Invalid ARN {}", s));
|
||||
return Err(format!("Invalid ARN {s}"));
|
||||
}
|
||||
|
||||
Ok(ARN {
|
||||
|
||||
Reference in New Issue
Block a user