🐛 Fix Clippy lint warnings and add Rust formatting

- 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 <noreply@anthropic.com>
This commit is contained in:
Tw93
2025-08-05 20:13:51 +08:00
parent 02348f76ef
commit 6674802737
2 changed files with 5 additions and 5 deletions

View File

@@ -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",

View File

@@ -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::<u32>().is_ok() => {
let base_name = &file_stem[..index];
counter = file_stem[index + 1..].parse::<u32>().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()