mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-26 16:28:15 +00:00
fix: Fixed detection warnings in rust v1.93.0 (#1591)
This commit is contained in:
@@ -436,20 +436,12 @@ impl DataUsageEntry {
|
||||
self.obj_sizes.add(summary.total_size as u64);
|
||||
self.obj_versions.add(summary.versions as u64);
|
||||
|
||||
let replication_stats = if self.replication_stats.is_none() {
|
||||
self.replication_stats = Some(ReplicationAllStats::default());
|
||||
self.replication_stats.as_mut().unwrap()
|
||||
} else {
|
||||
self.replication_stats.as_mut().unwrap()
|
||||
};
|
||||
let replication_stats = self.replication_stats.get_or_insert(ReplicationAllStats::default());
|
||||
replication_stats.replica_size += summary.replica_size as u64;
|
||||
replication_stats.replica_count += summary.replica_count as u64;
|
||||
|
||||
for (arn, st) in &summary.repl_target_stats {
|
||||
let tgt_stat = replication_stats
|
||||
.targets
|
||||
.entry(arn.to_string())
|
||||
.or_insert(ReplicationStats::default());
|
||||
let tgt_stat = replication_stats.targets.entry(arn.to_string()).or_default();
|
||||
tgt_stat.pending_size += st.pending_size as u64;
|
||||
tgt_stat.failed_size += st.failed_size as u64;
|
||||
tgt_stat.replicated_size += st.replicated_size as u64;
|
||||
|
||||
@@ -4640,17 +4640,8 @@ impl StorageAPI for SetDisks {
|
||||
let disks = self.get_disks_internal().await;
|
||||
|
||||
let (metas, errs) = {
|
||||
if opts.version_id.is_some() {
|
||||
Self::read_all_fileinfo(
|
||||
&disks,
|
||||
"",
|
||||
bucket,
|
||||
object,
|
||||
opts.version_id.as_ref().unwrap().to_string().as_str(),
|
||||
false,
|
||||
false,
|
||||
)
|
||||
.await?
|
||||
if let Some(vid) = opts.version_id.as_ref() {
|
||||
Self::read_all_fileinfo(&disks, "", bucket, object, vid.as_str(), false, false).await?
|
||||
} else {
|
||||
Self::read_all_xl(&disks, bucket, object, false, false).await
|
||||
}
|
||||
@@ -5680,20 +5671,12 @@ impl StorageAPI for SetDisks {
|
||||
return Err(Error::other("checksum type not found"));
|
||||
};
|
||||
|
||||
if opts.want_checksum.is_some()
|
||||
&& !opts.want_checksum.as_ref().is_some_and(|v| {
|
||||
v.checksum_type
|
||||
.is(rustfs_rio::ChecksumType::from_string_with_obj_type(cs, ct))
|
||||
})
|
||||
{
|
||||
return Err(Error::other(format!(
|
||||
"checksum type mismatch, got {:?}, want {:?}",
|
||||
opts.want_checksum.as_ref().unwrap(),
|
||||
rustfs_rio::ChecksumType::from_string_with_obj_type(cs, ct)
|
||||
)));
|
||||
}
|
||||
|
||||
checksum_type = rustfs_rio::ChecksumType::from_string_with_obj_type(cs, ct);
|
||||
if let Some(want) = opts.want_checksum.as_ref()
|
||||
&& !want.checksum_type.is(checksum_type)
|
||||
{
|
||||
return Err(Error::other(format!("checksum type mismatch, got {:?}, want {:?}", want, checksum_type)));
|
||||
}
|
||||
}
|
||||
|
||||
for (i, part) in object_parts.iter().enumerate() {
|
||||
|
||||
@@ -617,11 +617,7 @@ impl FileMeta {
|
||||
// delete_version deletes version, returns data_dir
|
||||
#[tracing::instrument(skip(self))]
|
||||
pub fn delete_version(&mut self, fi: &FileInfo) -> Result<Option<Uuid>> {
|
||||
let vid = if fi.version_id.is_none() {
|
||||
Some(Uuid::nil())
|
||||
} else {
|
||||
Some(fi.version_id.unwrap())
|
||||
};
|
||||
let vid = fi.version_id.or(Some(Uuid::nil()));
|
||||
|
||||
let mut ventry = FileMetaVersion::default();
|
||||
if fi.deleted {
|
||||
@@ -1729,15 +1725,13 @@ impl From<FileMetaVersion> for FileMetaVersionHeader {
|
||||
f
|
||||
};
|
||||
|
||||
let (ec_n, ec_m) = {
|
||||
if value.version_type == VersionType::Object && value.object.is_some() {
|
||||
(
|
||||
value.object.as_ref().unwrap().erasure_n as u8,
|
||||
value.object.as_ref().unwrap().erasure_m as u8,
|
||||
)
|
||||
} else {
|
||||
(0, 0)
|
||||
}
|
||||
let (ec_n, ec_m) = if value.version_type == VersionType::Object {
|
||||
value
|
||||
.object
|
||||
.as_ref()
|
||||
.map_or((0, 0), |o| (o.erasure_n as u8, o.erasure_m as u8))
|
||||
} else {
|
||||
(0, 0)
|
||||
};
|
||||
|
||||
Self {
|
||||
|
||||
@@ -521,20 +521,12 @@ impl DataUsageEntry {
|
||||
self.obj_sizes.add(summary.total_size as u64);
|
||||
self.obj_versions.add(summary.versions as u64);
|
||||
|
||||
let replication_stats = if self.replication_stats.is_none() {
|
||||
self.replication_stats = Some(ReplicationAllStats::default());
|
||||
self.replication_stats.as_mut().unwrap()
|
||||
} else {
|
||||
self.replication_stats.as_mut().unwrap()
|
||||
};
|
||||
let replication_stats = self.replication_stats.get_or_insert(ReplicationAllStats::default());
|
||||
replication_stats.replica_size += summary.replica_size as u64;
|
||||
replication_stats.replica_count += summary.replica_count as u64;
|
||||
|
||||
for (arn, st) in &summary.repl_target_stats {
|
||||
let tgt_stat = replication_stats
|
||||
.targets
|
||||
.entry(arn.to_string())
|
||||
.or_insert(ReplicationStats::default());
|
||||
let tgt_stat = replication_stats.targets.entry(arn.to_string()).or_default();
|
||||
tgt_stat.pending_size += st.pending_size as u64;
|
||||
tgt_stat.failed_size += st.failed_size as u64;
|
||||
tgt_stat.replicated_size += st.replicated_size as u64;
|
||||
|
||||
Reference in New Issue
Block a user