fix clippy

This commit is contained in:
weisd
2025-06-23 10:28:57 +08:00
parent 080af2b39f
commit 5a5712fde0
5 changed files with 10 additions and 25 deletions
+2 -6
View File
@@ -445,12 +445,8 @@ impl Event {
};
let mut resp_elements = args.resp_elements.clone();
resp_elements
.entry("x-amz-request-id".to_string())
.or_insert_with(|| "".to_string());
resp_elements
.entry("x-amz-id-2".to_string())
.or_insert_with(|| "".to_string());
resp_elements.entry("x-amz-request-id".to_string()).or_default();
resp_elements.entry("x-amz-id-2".to_string()).or_default();
// ... Filling of other response elements
// URL encoding of object keys
+1 -1
View File
@@ -54,7 +54,7 @@ impl Notifier {
// Create an event and send it
let event = Event::new(args.clone());
notification_sys
.send_event(&args.bucket_name, &args.event_name.as_str(), &args.object.name.clone(), event)
.send_event(&args.bucket_name, args.event_name.as_str(), args.object.name.as_str(), event)
.await;
}
}
+3 -12
View File
@@ -189,10 +189,7 @@ impl NotificationSystem {
info!("Attempting to remove target: {}", target_id);
let Some(store) = ecstore::global::new_object_layer_fn() else {
return Err(NotificationError::Io(std::io::Error::new(
std::io::ErrorKind::Other,
"errServerNotInitialized",
)));
return Err(NotificationError::Io(std::io::Error::other("errServerNotInitialized")));
};
let mut new_config = ecstore::config::com::read_config_without_migrate(store.clone())
@@ -243,10 +240,7 @@ impl NotificationSystem {
info!("Setting config for target {} of type {}", target_name, target_type);
// 1. Get the storage handle
let Some(store) = ecstore::global::new_object_layer_fn() else {
return Err(NotificationError::Io(std::io::Error::new(
std::io::ErrorKind::Other,
"errServerNotInitialized",
)));
return Err(NotificationError::Io(std::io::Error::other("errServerNotInitialized")));
};
// 2. Read the latest configuration from storage
@@ -306,10 +300,7 @@ impl NotificationSystem {
pub async fn remove_target_config(&self, target_type: &str, target_name: &str) -> Result<(), NotificationError> {
info!("Removing config for target {} of type {}", target_name, target_type);
let Some(store) = ecstore::global::new_object_layer_fn() else {
return Err(NotificationError::Io(std::io::Error::new(
std::io::ErrorKind::Other,
"errServerNotInitialized",
)));
return Err(NotificationError::Io(std::io::Error::other("errServerNotInitialized")));
};
let mut new_config = ecstore::config::com::read_config_without_migrate(store.clone())
+1 -1
View File
@@ -100,7 +100,7 @@ impl UserAgent {
fn get_macos_platform(_sys: &System) -> String {
let binding = System::os_version().unwrap_or("14.5.0".to_string());
let version = binding.split('.').collect::<Vec<&str>>();
let major = version.get(0).unwrap_or(&"14").to_string();
let major = version.first().unwrap_or(&"14").to_string();
let minor = version.get(1).unwrap_or(&"5").to_string();
let patch = version.get(2).unwrap_or(&"0").to_string();
+3 -5
View File
@@ -502,11 +502,9 @@ async fn run(opt: config::Opt) -> Result<()> {
});
// init store
let store = ECStore::new(server_addr.clone(), endpoint_pools.clone())
.await
.inspect_err(|err| {
error!("ECStore::new {:?}", err);
})?;
let store = ECStore::new(server_addr, endpoint_pools.clone()).await.inspect_err(|err| {
error!("ECStore::new {:?}", err);
})?;
ecconfig::init();
// config system configuration