mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-08 06:13:14 +00:00
fix:Apply suggestions from clippy 1.88 (#20)
This commit is contained in:
@@ -81,7 +81,7 @@ impl Operation for SetNotificationTarget {
|
||||
.await
|
||||
.map_err(|e| {
|
||||
error!("failed to set target config: {}", e);
|
||||
S3Error::with_message(S3ErrorCode::InternalError, format!("failed to set target config: {}", e))
|
||||
S3Error::with_message(S3ErrorCode::InternalError, format!("failed to set target config: {e}"))
|
||||
})?;
|
||||
|
||||
let mut header = HeaderMap::new();
|
||||
@@ -124,7 +124,7 @@ impl Operation for ListNotificationTargets {
|
||||
|
||||
// 4. Serialize and return the result
|
||||
let data = serde_json::to_vec(&data_target_arn_list)
|
||||
.map_err(|e| S3Error::with_message(S3ErrorCode::InternalError, format!("failed to serialize targets: {}", e)))?;
|
||||
.map_err(|e| S3Error::with_message(S3ErrorCode::InternalError, format!("failed to serialize targets: {e}")))?;
|
||||
debug!("ListNotificationTargets call end, response data length: {}", data.len(),);
|
||||
let mut header = HeaderMap::new();
|
||||
header.insert(CONTENT_TYPE, "application/json".parse().unwrap());
|
||||
@@ -159,7 +159,7 @@ impl Operation for RemoveNotificationTarget {
|
||||
.await
|
||||
.map_err(|e| {
|
||||
error!("failed to remove target config: {}", e);
|
||||
S3Error::with_message(S3ErrorCode::InternalError, format!("failed to remove target config: {}", e))
|
||||
S3Error::with_message(S3ErrorCode::InternalError, format!("failed to remove target config: {e}"))
|
||||
})?;
|
||||
|
||||
let mut header = HeaderMap::new();
|
||||
@@ -204,7 +204,7 @@ impl Operation for SetBucketNotification {
|
||||
.await
|
||||
.map_err(|e| {
|
||||
error!("failed to load bucket notification config: {}", e);
|
||||
S3Error::with_message(S3ErrorCode::InternalError, format!("failed to load bucket notification config: {}", e))
|
||||
S3Error::with_message(S3ErrorCode::InternalError, format!("failed to load bucket notification config: {e}"))
|
||||
})?;
|
||||
|
||||
let mut header = HeaderMap::new();
|
||||
@@ -241,7 +241,7 @@ impl Operation for GetBucketNotification {
|
||||
};
|
||||
|
||||
let data = serde_json::to_vec(&response)
|
||||
.map_err(|e| S3Error::with_message(S3ErrorCode::InternalError, format!("failed to serialize rules: {}", e)))?;
|
||||
.map_err(|e| S3Error::with_message(S3ErrorCode::InternalError, format!("failed to serialize rules: {e}")))?;
|
||||
|
||||
let mut header = HeaderMap::new();
|
||||
header.insert(CONTENT_TYPE, "application/json".parse().unwrap());
|
||||
|
||||
@@ -145,7 +145,7 @@ impl Operation for AddTier {
|
||||
warn!("tier_config_mgr add failed, e: {:?}", err);
|
||||
return Err(S3Error::with_message(
|
||||
S3ErrorCode::Custom("TierAddFailed".into()),
|
||||
format!("tier add failed. {}", err),
|
||||
format!("tier add failed. {err}"),
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -212,7 +212,7 @@ impl Operation for EditTier {
|
||||
warn!("tier_config_mgr edit failed, e: {:?}", err);
|
||||
return Err(S3Error::with_message(
|
||||
S3ErrorCode::Custom("TierEditFailed".into()),
|
||||
format!("tier edit failed. {}", err),
|
||||
format!("tier edit failed. {err}"),
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -307,7 +307,7 @@ impl Operation for RemoveTier {
|
||||
warn!("tier_config_mgr remove failed, e: {:?}", err);
|
||||
return Err(S3Error::with_message(
|
||||
S3ErrorCode::Custom("TierRemoveFailed".into()),
|
||||
format!("tier remove failed. {}", err),
|
||||
format!("tier remove failed. {err}"),
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -434,7 +434,7 @@ impl Operation for ClearTier {
|
||||
warn!("tier_config_mgr clear failed, e: {:?}", err);
|
||||
return Err(S3Error::with_message(
|
||||
S3ErrorCode::Custom("TierClearFailed".into()),
|
||||
format!("tier clear failed. {}", err),
|
||||
format!("tier clear failed. {err}"),
|
||||
));
|
||||
}
|
||||
if let Err(e) = tier_config_mgr.save().await {
|
||||
|
||||
@@ -104,8 +104,7 @@ impl VersionChecker {
|
||||
let error_text = response.text().await.unwrap_or_default();
|
||||
error!("Version check request failed, status code: {}, response: {}", status, error_text);
|
||||
return Err(UpdateCheckError::InvalidResponse(format!(
|
||||
"HTTP status code: {}, response: {}",
|
||||
status, error_text
|
||||
"HTTP status code: {status}, response: {error_text}"
|
||||
)));
|
||||
}
|
||||
|
||||
@@ -117,8 +116,7 @@ impl VersionChecker {
|
||||
let error_text = String::from_utf8_lossy(&response_bytes);
|
||||
error!("Version check request failed, response: {}", e);
|
||||
return Err(UpdateCheckError::InvalidResponse(format!(
|
||||
"JSON parsing failed: {}, response: {}",
|
||||
e, error_text
|
||||
"JSON parsing failed: {e}, response: {error_text}"
|
||||
)));
|
||||
}
|
||||
};
|
||||
@@ -196,7 +194,7 @@ impl VersionChecker {
|
||||
let parts: Vec<&str> = version.split('.').collect();
|
||||
|
||||
if parts.len() < 3 {
|
||||
return Err(UpdateCheckError::VersionParseError(format!("Invalid version format: {}", version)));
|
||||
return Err(UpdateCheckError::VersionParseError(format!("Invalid version format: {version}")));
|
||||
}
|
||||
|
||||
let major = parts[0]
|
||||
@@ -292,7 +290,7 @@ mod tests {
|
||||
async fn test_get_current_version() {
|
||||
let version = get_current_version();
|
||||
assert!(!version.is_empty());
|
||||
println!("Current version: {}", version);
|
||||
println!("Current version: {version}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -341,7 +339,7 @@ mod tests {
|
||||
assert_eq!(cloned_result.check_time, result.check_time);
|
||||
|
||||
// Test Debug functionality (should not panic)
|
||||
let debug_output = format!("{:?}", result);
|
||||
let debug_output = format!("{result:?}");
|
||||
assert!(debug_output.contains("UpdateCheckResult"));
|
||||
assert!(debug_output.contains("1.1.0"));
|
||||
assert!(debug_output.contains("1.2.0"));
|
||||
@@ -403,7 +401,7 @@ mod tests {
|
||||
assert_eq!(cloned_info.download_url, version_info.download_url);
|
||||
|
||||
// Test Debug functionality
|
||||
let debug_output = format!("{:?}", version_info);
|
||||
let debug_output = format!("{version_info:?}");
|
||||
assert!(debug_output.contains("VersionInfo"));
|
||||
assert!(debug_output.contains("2.0.0"));
|
||||
|
||||
@@ -422,7 +420,7 @@ mod tests {
|
||||
|
||||
// Test JSON serialization/deserialization
|
||||
let json_string = serde_json::to_string(&version_info).unwrap();
|
||||
println!("json_string: {}", json_string);
|
||||
println!("json_string: {json_string}");
|
||||
assert!(json_string.contains("2.0.0"));
|
||||
assert!(json_string.contains("Major release"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user