From 00e7d792b948b8fcbed71f40ea654c4afd8c3640 Mon Sep 17 00:00:00 2001 From: Valentine Briese Date: Sat, 14 Oct 2023 15:32:39 -0700 Subject: [PATCH] Simplify `threads` field unwrapping --- crunchy-cli-core/src/utils/download.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/crunchy-cli-core/src/utils/download.rs b/crunchy-cli-core/src/utils/download.rs index 2817c48..cdf0753 100644 --- a/crunchy-cli-core/src/utils/download.rs +++ b/crunchy-cli-core/src/utils/download.rs @@ -576,11 +576,7 @@ impl Downloader { }; // If `threads` is specified, use that many CPU cores(?). - let cpus = if let Some(threads) = self.threads { - threads - } else { - num_cpus::get() - }; + let cpus = self.threads.unwrap_or(num_cpus::get()); let mut segs: Vec> = Vec::with_capacity(cpus); for _ in 0..cpus { segs.push(vec![])