From 2aba45431863a976d770f8e82fc0b15cfba890b0 Mon Sep 17 00:00:00 2001 From: weisd Date: Sun, 3 Nov 2024 10:25:17 +0800 Subject: [PATCH] fix cargo clippy err --- ecstore/src/config/storageclass.rs | 36 +++++++++++++++--------------- ecstore/src/heal/heal_commands.rs | 6 ++--- ecstore/src/heal/heal_ops.rs | 4 ++-- ecstore/src/store.rs | 2 +- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/ecstore/src/config/storageclass.rs b/ecstore/src/config/storageclass.rs index f5bb31be8..c825875a3 100644 --- a/ecstore/src/config/storageclass.rs +++ b/ecstore/src/config/storageclass.rs @@ -253,12 +253,12 @@ pub fn parse_storage_class(env: &str) -> Result { // ValidateParity validates standard storage class parity. pub fn validate_parity(ss_parity: usize, set_drive_count: usize) -> Result<()> { - if ss_parity > 0 && ss_parity < MIN_PARITY_DRIVES { - return Err(Error::msg(format!( - "parity {} should be greater than or equal to {}", - ss_parity, MIN_PARITY_DRIVES - ))); - } + // if ss_parity > 0 && ss_parity < MIN_PARITY_DRIVES { + // return Err(Error::msg(format!( + // "parity {} should be greater than or equal to {}", + // ss_parity, MIN_PARITY_DRIVES + // ))); + // } if ss_parity > set_drive_count / 2 { 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. 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 { - return Err(Error::msg(format!( - "Standard storage class parity {} should be greater than or equal to {}", - ss_parity, MIN_PARITY_DRIVES - ))); - } + // if ss_parity > 0 && ss_parity < MIN_PARITY_DRIVES { + // return Err(Error::msg(format!( + // "Standard storage class parity {} should be greater than or equal to {}", + // ss_parity, MIN_PARITY_DRIVES + // ))); + // } // RRS parity drives should be greater than or equal to minParityDrives. // Parity below minParityDrives is not supported. - if rrs_parity > 0 && rrs_parity < MIN_PARITY_DRIVES { - return Err(Error::msg(format!( - "Reduced redundancy storage class parity {} should be greater than or equal to {}", - rrs_parity, MIN_PARITY_DRIVES - ))); - } + // if rrs_parity > 0 && rrs_parity < MIN_PARITY_DRIVES { + // return Err(Error::msg(format!( + // "Reduced redundancy storage class parity {} should be greater than or equal to {}", + // rrs_parity, MIN_PARITY_DRIVES + // ))); + // } if set_drive_count > 2 { if ss_parity > set_drive_count / 2 { diff --git a/ecstore/src/heal/heal_commands.rs b/ecstore/src/heal/heal_commands.rs index 29d9bd550..cc2578041 100644 --- a/ecstore/src/heal/heal_commands.rs +++ b/ecstore/src/heal/heal_commands.rs @@ -421,12 +421,12 @@ async fn load_healing_tracker(disk: &Option) -> Result) { } }, None => { - return; + } } @@ -462,7 +462,7 @@ impl AllHealState { } } - return (None, false); + (None, false) } async fn get_heal_sequence(&self, path: &str) -> Option { diff --git a/ecstore/src/store.rs b/ecstore/src/store.rs index ef1140c06..96ed9a106 100644 --- a/ecstore/src/store.rs +++ b/ecstore/src/store.rs @@ -1797,7 +1797,7 @@ async fn has_space_for(dis: &Vec>, size: i64) -> Result { } } - if disks_num < dis.len() / 2 || disks_num <= 0 { + if disks_num < dis.len() / 2 || disks_num == 0 { return Err(Error::msg(format!( "not enough online disks to calculate the available space,need {}, found {}", (dis.len() / 2) + 1,