mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-27 15:37:02 +00:00
fix: auto-repair clippy failures from d666028cdc (#4172)
fix: simplify match arms to satisfy clippy manual-unwrap-or-default and manual-unwrap-or Two match expressions in crates/replication/src/runtime.rs triggered clippy lints (manual-unwrap-or-default, manual-unwrap-or) with the project's -D warnings policy. Replace them with the idiomatic .unwrap_or_default() and .unwrap_or() calls.
This commit is contained in:
@@ -84,10 +84,7 @@ pub fn resized_worker_counts(
|
|||||||
|
|
||||||
pub fn mrf_worker_size_to_count(size: i32) -> usize {
|
pub fn mrf_worker_size_to_count(size: i32) -> usize {
|
||||||
let non_negative = size.max(0);
|
let non_negative = size.max(0);
|
||||||
match usize::try_from(non_negative) {
|
usize::try_from(non_negative).unwrap_or_default()
|
||||||
Ok(size) => size,
|
|
||||||
Err(_) => 0,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn worker_counts_for_priority(
|
pub fn worker_counts_for_priority(
|
||||||
@@ -145,10 +142,7 @@ fn auto_worker_count(current_workers: usize, auto_default: usize) -> usize {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn usize_to_i32_saturating(value: usize) -> i32 {
|
fn usize_to_i32_saturating(value: usize) -> i32 {
|
||||||
match i32::try_from(value) {
|
i32::try_from(value).unwrap_or(i32::MAX)
|
||||||
Ok(value) => value,
|
|
||||||
Err(_) => i32::MAX,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
Reference in New Issue
Block a user