make clippy happy

This commit is contained in:
JimChenWYU
2024-09-23 15:38:00 +08:00
parent 48d2285d36
commit 184d593d27
+9 -16
View File
@@ -205,10 +205,10 @@ impl StorageAPI for Sets {
let mut set_obj_map = HashMap::new(); let mut set_obj_map = HashMap::new();
// hash key // hash key
let mut i = 0; for (i, obj) in objects.iter().enumerate() {
for obj in objects.iter() {
let idx = self.get_hashed_set_index(obj.object_name.as_str()); let idx = self.get_hashed_set_index(obj.object_name.as_str());
#[allow(clippy::map_entry)]
if !set_obj_map.contains_key(&idx) { if !set_obj_map.contains_key(&idx) {
set_obj_map.insert( set_obj_map.insert(
idx, idx,
@@ -218,17 +218,13 @@ impl StorageAPI for Sets {
obj: obj.clone(), obj: obj.clone(),
}], }],
); );
} else { } else if let Some(val) = set_obj_map.get_mut(&idx) {
if let Some(val) = set_obj_map.get_mut(&idx) { val.push(DelObj {
val.push(DelObj { // set_idx: idx,
// set_idx: idx, orig_idx: i,
orig_idx: i, obj: obj.clone(),
obj: obj.clone(), });
});
}
} }
i += 1;
} }
// TODO: 并发 // TODO: 并发
@@ -237,15 +233,12 @@ impl StorageAPI for Sets {
let objs: Vec<ObjectToDelete> = v.iter().map(|v| v.obj.clone()).collect(); let objs: Vec<ObjectToDelete> = v.iter().map(|v| v.obj.clone()).collect();
let (dobjects, errs) = disks.delete_objects(bucket, objs, opts.clone()).await?; let (dobjects, errs) = disks.delete_objects(bucket, objs, opts.clone()).await?;
let mut i = 0; for (i, err) in errs.into_iter().enumerate() {
for err in errs {
let obj = v.get(i).unwrap(); let obj = v.get(i).unwrap();
del_errs[obj.orig_idx] = err; del_errs[obj.orig_idx] = err;
del_objects[obj.orig_idx] = dobjects.get(i).unwrap().clone(); del_objects[obj.orig_idx] = dobjects.get(i).unwrap().clone();
i += 1;
} }
} }