fix(official-sync): 修复阻塞 clippy 门禁的两处告警

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 <noreply@anthropic.com>
This commit is contained in:
2026-07-16 04:40:35 -07:00
co-authored by Claude Fable 5
parent eef8c52497
commit 810b39c2cd
2 changed files with 21 additions and 14 deletions
+3 -3
View File
@@ -2024,9 +2024,9 @@ fn print_daemon_version_state_summary(version_state: &OfficialVersionState) {
} }
} }
fn visible_historical_failed_versions<'a>( fn visible_historical_failed_versions(
version_state: &'a OfficialVersionState, version_state: &OfficialVersionState,
) -> Vec<&'a OfficialFailedVersionRecord> { ) -> Vec<&OfficialFailedVersionRecord> {
let in_progress = version_state.in_progress_version.as_ref(); let in_progress = version_state.in_progress_version.as_ref();
version_state version_state
.failed_versions .failed_versions
+18 -11
View File
@@ -911,9 +911,11 @@ impl OfficialUpdateService {
)); ));
Some(resolve_bootstrap( Some(resolve_bootstrap(
&config.launcher_version, &config.launcher_version,
&config.curl_command, &BootstrapTools {
&config.curl_proxy, curl_command: &config.curl_command,
&config.unzip_command, curl_proxy: &config.curl_proxy,
unzip_command: &config.unzip_command,
},
&bootstrap_cache_path, &bootstrap_cache_path,
!config.dry_run, !config.dry_run,
&mut progress, &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( fn resolve_bootstrap(
launcher_version: &str, launcher_version: &str,
curl_command: &Path, tools: &BootstrapTools<'_>,
curl_proxy: &CurlProxyConfig,
unzip_command: &Path,
cache_path: &Path, cache_path: &Path,
write_cache: bool, write_cache: bool,
progress: &mut dyn FnMut(OfficialUpdateProgress), progress: &mut dyn FnMut(OfficialUpdateProgress),
@@ -2377,9 +2384,9 @@ fn resolve_bootstrap(
check_shutdown_requested(should_cancel)?; check_shutdown_requested(should_cancel)?;
let launcher = OfficialLauncherBootstrapService::with_curl_command( let launcher = OfficialLauncherBootstrapService::with_curl_command(
launcher_version, 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( progress(OfficialUpdateProgress::new(
"launcher", "launcher",
"正在拉取官方启动器游戏配置和远端 manifest", "正在拉取官方启动器游戏配置和远端 manifest",
@@ -2425,10 +2432,10 @@ fn resolve_bootstrap(
check_shutdown_requested(should_cancel)?; check_shutdown_requested(should_cancel)?;
let bootstrapper = OfficialGameMainConfigBootstrapService::with_commands( let bootstrapper = OfficialGameMainConfigBootstrapService::with_commands(
launcher_version, launcher_version,
curl_command.to_path_buf(), tools.curl_command.to_path_buf(),
unzip_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)?; let bootstrap = bootstrapper.fetch_bootstrap().map_err(anyhow::Error::msg)?;
check_shutdown_requested(should_cancel)?; check_shutdown_requested(should_cancel)?;
let launcher_metadata = LauncherMetadataSnapshot { let launcher_metadata = LauncherMetadataSnapshot {