From 66748027371ac03e99c74b546d0ce07098fbcd21 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Tue, 5 Aug 2025 20:13:51 +0800 Subject: [PATCH] :bug: Fix Clippy lint warnings and add Rust formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update format strings to use inline arguments in util.rs - Add cargo fmt to npm run format script for unified code formatting 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- package.json | 2 +- src-tauri/src/util.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index ce701fb..9df1646 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "cli": "rollup -c rollup.config.js --watch", "cli:dev": "cross-env NODE_ENV=development rollup -c rollup.config.js -w", "cli:build": "cross-env NODE_ENV=production rollup -c rollup.config.js", - "format": "npx prettier --write . --ignore-unknown", + "format": "npx prettier --write . --ignore-unknown && cd src-tauri && cargo fmt", "prepublishOnly": "npm run cli:build" }, "type": "module", diff --git a/src-tauri/src/util.rs b/src-tauri/src/util.rs index e77160b..7f063e4 100644 --- a/src-tauri/src/util.rs +++ b/src-tauri/src/util.rs @@ -40,7 +40,7 @@ pub fn get_data_dir(app: &AppHandle, package_name: String) -> PathBuf { } pub fn show_toast(window: &WebviewWindow, message: &str) { - let script = format!(r#"pakeToast("{}");"#, message); + let script = format!(r#"pakeToast("{message}");"#); window.eval(&script).unwrap(); } @@ -98,15 +98,15 @@ pub fn check_file_or_append(file_path: &str) -> String { Some(index) if file_stem[index + 1..].parse::().is_ok() => { let base_name = &file_stem[..index]; counter = file_stem[index + 1..].parse::().unwrap() + 1; - format!("{}-{}", base_name, counter) + format!("{base_name}-{counter}") } _ => { counter += 1; - format!("{}-{}", file_stem, counter) + format!("{file_stem}-{counter}") } }; - new_path = parent_dir.join(format!("{}.{}", new_file_stem, extension)); + new_path = parent_dir.join(format!("{new_file_stem}.{extension}")); } new_path.to_string_lossy().into_owned()