From 1126f2e2ea2f96dcd26e44191af905cd83a31273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Tue, 1 Sep 2026 20:13:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20Rust=20=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 按 rustfmt 规范调整更新下载代码排版 按 rustfmt 规范调整预览路径回归测试排版 --- apps/ai-game-creator-shell/src-tauri/src/main.rs | 7 ++++--- apps/ai-game-creator-shell/src-tauri/src/preview.rs | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/main.rs b/apps/ai-game-creator-shell/src-tauri/src/main.rs index 1ea6451b8..677035b87 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/main.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/main.rs @@ -97,7 +97,8 @@ async fn download_agc_update( expected_sha256: Option, expected_size: Option, ) -> Result { - let parsed = url::Url::parse(download_url.trim()).map_err(|_| "更新下载地址无效".to_string())?; + let parsed = + url::Url::parse(download_url.trim()).map_err(|_| "更新下载地址无效".to_string())?; if parsed.scheme() != "https" || parsed.host_str() != Some(AGC_UPDATE_OSS_HOST) { return Err("更新下载地址必须来自受信任的 OSS".to_string()); } @@ -215,8 +216,8 @@ async fn download_agc_update( let _ = fs::remove_file(&temporary); return Err(format!("提交更新文件失败:{error}")); } - let relaunch_path = std::env::current_exe() - .map_err(|error| format!("无法定位客户端程序:{error}"))?; + let relaunch_path = + std::env::current_exe().map_err(|error| format!("无法定位客户端程序:{error}"))?; launch_agc_installer(&target, &relaunch_path)?; app.exit(0); Ok(target.to_string_lossy().into_owned()) diff --git a/apps/ai-game-creator-shell/src-tauri/src/preview.rs b/apps/ai-game-creator-shell/src-tauri/src/preview.rs index 587b7f01a..ab6c73245 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/preview.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/preview.rs @@ -1675,7 +1675,10 @@ mod tests { .join("ui/generated-x.js") .canonicalize() .expect("canonical generated module"); - assert_eq!(resolve_preview_path(root.path(), "/ui/generated-x.js").unwrap(), expected); + assert_eq!( + resolve_preview_path(root.path(), "/ui/generated-x.js").unwrap(), + expected + ); let response = build_preview_response(root.path(), "GET", "/ui/generated-x.js"); let response_text = String::from_utf8_lossy(&response);