diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-21 17:02:52 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-21 17:12:37 +0900 |
| commit | 84fe6ac6977f15cbec85cbc9f773567742a7fb87 (patch) | |
| tree | 5701e7c980585dd404471ab9fa53e98a0ba601ab /crates/shirabe/src/util/http_downloader.rs | |
| parent | 12a7756588a20f1351e6976f0c009de5992514a9 (diff) | |
| download | php-shirabe-84fe6ac6977f15cbec85cbc9f773567742a7fb87.tar.gz php-shirabe-84fe6ac6977f15cbec85cbc9f773567742a7fb87.tar.zst php-shirabe-84fe6ac6977f15cbec85cbc9f773567742a7fb87.zip | |
refactor(math): use method-style max/min/clamp over std::cmp
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/http_downloader.rs')
| -rw-r--r-- | crates/shirabe/src/util/http_downloader.rs | 17 |
1 files changed, 8 insertions, 9 deletions
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 { |
