From 810b39c2cddb93e88c122ab4fbe9ebe1e79fa7e0 Mon Sep 17 00:00:00 2001 From: Yuyi-Oak <1722157266@qq.com> Date: Thu, 16 Jul 2026 04:40:35 -0700 Subject: [PATCH] =?UTF-8?q?fix(official-sync):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=98=BB=E5=A1=9E=20clippy=20=E9=97=A8=E7=A6=81=E7=9A=84?= =?UTF-8?q?=E4=B8=A4=E5=A4=84=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cargo clippy --workspace -- -D warnings 在 HEAD 上失败,阻塞项目验证门禁: - resolve_bootstrap 因 c123f6c 新增 curl_proxy 参数达到 8 个,触发 too_many_arguments。将 curl_command/curl_proxy/unzip_command 收拢为 BootstrapTools 结构体,降到 6 个参数。 - visible_historical_failed_versions(169822a 引入)的显式生命周期可省略, 触发 needless_lifetimes。按 clippy 建议省略。 对应 issue #18 维护清单 1-7。 Co-Authored-By: Claude Fable 5 --- infrastructure/src/bin/bat_official_sync.rs | 6 ++--- infrastructure/src/official_update.rs | 29 +++++++++++++-------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/infrastructure/src/bin/bat_official_sync.rs b/infrastructure/src/bin/bat_official_sync.rs index 825fe8e..ea5b538 100644 --- a/infrastructure/src/bin/bat_official_sync.rs +++ b/infrastructure/src/bin/bat_official_sync.rs @@ -2024,9 +2024,9 @@ fn print_daemon_version_state_summary(version_state: &OfficialVersionState) { } } -fn visible_historical_failed_versions<'a>( - version_state: &'a OfficialVersionState, -) -> Vec<&'a OfficialFailedVersionRecord> { +fn visible_historical_failed_versions( + version_state: &OfficialVersionState, +) -> Vec<&OfficialFailedVersionRecord> { let in_progress = version_state.in_progress_version.as_ref(); version_state .failed_versions diff --git a/infrastructure/src/official_update.rs b/infrastructure/src/official_update.rs index fdc50d8..2d3fadc 100644 --- a/infrastructure/src/official_update.rs +++ b/infrastructure/src/official_update.rs @@ -911,9 +911,11 @@ impl OfficialUpdateService { )); Some(resolve_bootstrap( &config.launcher_version, - &config.curl_command, - &config.curl_proxy, - &config.unzip_command, + &BootstrapTools { + curl_command: &config.curl_command, + curl_proxy: &config.curl_proxy, + unzip_command: &config.unzip_command, + }, &bootstrap_cache_path, !config.dry_run, &mut progress, @@ -2364,11 +2366,16 @@ fn game_main_config_snapshot(config: &YostarJpGameMainConfig) -> GameMainConfigS } } +/// 官方引导链路使用的外部命令与代理配置。 +struct BootstrapTools<'a> { + curl_command: &'a Path, + curl_proxy: &'a CurlProxyConfig, + unzip_command: &'a Path, +} + fn resolve_bootstrap( launcher_version: &str, - curl_command: &Path, - curl_proxy: &CurlProxyConfig, - unzip_command: &Path, + tools: &BootstrapTools<'_>, cache_path: &Path, write_cache: bool, progress: &mut dyn FnMut(OfficialUpdateProgress), @@ -2377,9 +2384,9 @@ fn resolve_bootstrap( check_shutdown_requested(should_cancel)?; let launcher = OfficialLauncherBootstrapService::with_curl_command( launcher_version, - curl_command.to_string_lossy().to_string(), + tools.curl_command.to_string_lossy().to_string(), ) - .with_proxy_config(curl_proxy.clone()); + .with_proxy_config(tools.curl_proxy.clone()); progress(OfficialUpdateProgress::new( "launcher", "正在拉取官方启动器游戏配置和远端 manifest", @@ -2425,10 +2432,10 @@ fn resolve_bootstrap( check_shutdown_requested(should_cancel)?; let bootstrapper = OfficialGameMainConfigBootstrapService::with_commands( launcher_version, - curl_command.to_path_buf(), - unzip_command.to_path_buf(), + tools.curl_command.to_path_buf(), + tools.unzip_command.to_path_buf(), ) - .with_proxy_config(curl_proxy.clone()); + .with_proxy_config(tools.curl_proxy.clone()); let bootstrap = bootstrapper.fetch_bootstrap().map_err(anyhow::Error::msg)?; check_shutdown_requested(should_cancel)?; let launcher_metadata = LauncherMetadataSnapshot {