From 84fe6ac6977f15cbec85cbc9f773567742a7fb87 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 21 Jun 2026 17:02:52 +0900 Subject: refactor(math): use method-style max/min/clamp over std::cmp Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/util/http_downloader.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'crates/shirabe/src/util/http_downloader.rs') diff --git a/crates/shirabe/src/util/http_downloader.rs b/crates/shirabe/src/util/http_downloader.rs index d5d619d..0c7308d 100644 --- a/crates/shirabe/src/util/http_downloader.rs +++ b/crates/shirabe/src/util/http_downloader.rs @@ -7,8 +7,8 @@ use crate::util::Silencer; use shirabe_external_packages::composer::pcre::{CaptureKey, Preg}; use shirabe_php_shim::{ InvalidArgumentException, LogicException, PhpMixed, array_replace_recursive, chr, - extension_loaded, file_get_contents, function_exists, implode, is_numeric, max, min, - rawurldecode, stream_context_create, stripos, strpos, substr, ucfirst, + extension_loaded, file_get_contents, function_exists, implode, is_numeric, rawurldecode, + stream_context_create, stripos, strpos, substr, ucfirst, }; use shirabe_semver::constraint::AnyConstraint; use shirabe_semver::constraint::SimpleConstraint; @@ -148,13 +148,12 @@ impl HttpDownloader { None => PhpMixed::Bool(false), }; if is_numeric(&max_jobs_env_mixed) { - max_jobs = max( - 1, - min( - 50, - max_jobs_env.as_deref().unwrap_or("0").parse().unwrap_or(0), - ), - ); + max_jobs = max_jobs_env + .as_deref() + .unwrap_or("0") + .parse() + .unwrap_or(0) + .clamp(1, 50); } Self { -- cgit v1.3.1