mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-25 13:36:50 +00:00
fix cargo clippy err
This commit is contained in:
@@ -253,12 +253,12 @@ pub fn parse_storage_class(env: &str) -> Result<StorageClass> {
|
|||||||
|
|
||||||
// ValidateParity validates standard storage class parity.
|
// ValidateParity validates standard storage class parity.
|
||||||
pub fn validate_parity(ss_parity: usize, set_drive_count: usize) -> Result<()> {
|
pub fn validate_parity(ss_parity: usize, set_drive_count: usize) -> Result<()> {
|
||||||
if ss_parity > 0 && ss_parity < MIN_PARITY_DRIVES {
|
// if ss_parity > 0 && ss_parity < MIN_PARITY_DRIVES {
|
||||||
return Err(Error::msg(format!(
|
// return Err(Error::msg(format!(
|
||||||
"parity {} should be greater than or equal to {}",
|
// "parity {} should be greater than or equal to {}",
|
||||||
ss_parity, MIN_PARITY_DRIVES
|
// ss_parity, MIN_PARITY_DRIVES
|
||||||
)));
|
// )));
|
||||||
}
|
// }
|
||||||
|
|
||||||
if ss_parity > set_drive_count / 2 {
|
if ss_parity > set_drive_count / 2 {
|
||||||
return Err(Error::msg(format!(
|
return Err(Error::msg(format!(
|
||||||
@@ -273,21 +273,21 @@ pub fn validate_parity(ss_parity: usize, set_drive_count: usize) -> Result<()> {
|
|||||||
|
|
||||||
// Validates the parity drives.
|
// Validates the parity drives.
|
||||||
pub fn validate_parity_inner(ss_parity: usize, rrs_parity: usize, set_drive_count: usize) -> Result<()> {
|
pub fn validate_parity_inner(ss_parity: usize, rrs_parity: usize, set_drive_count: usize) -> Result<()> {
|
||||||
if ss_parity > 0 && ss_parity < MIN_PARITY_DRIVES {
|
// if ss_parity > 0 && ss_parity < MIN_PARITY_DRIVES {
|
||||||
return Err(Error::msg(format!(
|
// return Err(Error::msg(format!(
|
||||||
"Standard storage class parity {} should be greater than or equal to {}",
|
// "Standard storage class parity {} should be greater than or equal to {}",
|
||||||
ss_parity, MIN_PARITY_DRIVES
|
// ss_parity, MIN_PARITY_DRIVES
|
||||||
)));
|
// )));
|
||||||
}
|
// }
|
||||||
|
|
||||||
// RRS parity drives should be greater than or equal to minParityDrives.
|
// RRS parity drives should be greater than or equal to minParityDrives.
|
||||||
// Parity below minParityDrives is not supported.
|
// Parity below minParityDrives is not supported.
|
||||||
if rrs_parity > 0 && rrs_parity < MIN_PARITY_DRIVES {
|
// if rrs_parity > 0 && rrs_parity < MIN_PARITY_DRIVES {
|
||||||
return Err(Error::msg(format!(
|
// return Err(Error::msg(format!(
|
||||||
"Reduced redundancy storage class parity {} should be greater than or equal to {}",
|
// "Reduced redundancy storage class parity {} should be greater than or equal to {}",
|
||||||
rrs_parity, MIN_PARITY_DRIVES
|
// rrs_parity, MIN_PARITY_DRIVES
|
||||||
)));
|
// )));
|
||||||
}
|
// }
|
||||||
|
|
||||||
if set_drive_count > 2 {
|
if set_drive_count > 2 {
|
||||||
if ss_parity > set_drive_count / 2 {
|
if ss_parity > set_drive_count / 2 {
|
||||||
|
|||||||
@@ -421,12 +421,12 @@ async fn load_healing_tracker(disk: &Option<DiskStore>) -> Result<HealingTracker
|
|||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
healing_tracker.id = disk_id;
|
healing_tracker.id = disk_id;
|
||||||
return Ok(healing_tracker);
|
Ok(healing_tracker)
|
||||||
} else {
|
} else {
|
||||||
return Err(Error::from_string("loadHealingTracker: disk not have id"));
|
Err(Error::from_string("loadHealingTracker: disk not have id"))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return Err(Error::from_string("loadHealingTracker: nil drive given"));
|
Err(Error::from_string("loadHealingTracker: nil drive given"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ pub async fn heal_sequence_start(h: Arc<HealSequence>) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,7 +462,7 @@ impl AllHealState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (None, false);
|
(None, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_heal_sequence(&self, path: &str) -> Option<HealSequence> {
|
async fn get_heal_sequence(&self, path: &str) -> Option<HealSequence> {
|
||||||
|
|||||||
@@ -1797,7 +1797,7 @@ async fn has_space_for(dis: &Vec<Option<DiskInfo>>, size: i64) -> Result<bool> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if disks_num < dis.len() / 2 || disks_num <= 0 {
|
if disks_num < dis.len() / 2 || disks_num == 0 {
|
||||||
return Err(Error::msg(format!(
|
return Err(Error::msg(format!(
|
||||||
"not enough online disks to calculate the available space,need {}, found {}",
|
"not enough online disks to calculate the available space,need {}, found {}",
|
||||||
(dis.len() / 2) + 1,
|
(dis.len() / 2) + 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user