From 4615df006d854eeced444e7650378a09bbe5f946 Mon Sep 17 00:00:00 2001 From: Zhengchao An Date: Thu, 2 Jul 2026 14:11:44 +0800 Subject: [PATCH] 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. --- crates/replication/src/runtime.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/crates/replication/src/runtime.rs b/crates/replication/src/runtime.rs index 6876df660..cb4122368 100644 --- a/crates/replication/src/runtime.rs +++ b/crates/replication/src/runtime.rs @@ -84,10 +84,7 @@ pub fn resized_worker_counts( pub fn mrf_worker_size_to_count(size: i32) -> usize { let non_negative = size.max(0); - match usize::try_from(non_negative) { - Ok(size) => size, - Err(_) => 0, - } + usize::try_from(non_negative).unwrap_or_default() } 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 { - match i32::try_from(value) { - Ok(value) => value, - Err(_) => i32::MAX, - } + i32::try_from(value).unwrap_or(i32::MAX) } #[cfg(test)]