fix: 审查修复 — save_profile 保留原始 created、&str 参数、clippy 清理

- CRITICAL: save_profile 覆盖已有配置时保留原始创建时间
- HIGH: profiles.rs 函数参数 String → &str(减少不必要的克隆)
- MEDIUM: 修复 18 个 clippy警告(空行 + map_or + collapsible-if)
- CLI: 移除不必要的 name.clone() 调用

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-28 23:26:54 +08:00
parent 812f39b159
commit 36e1c89b2e
8 changed files with 27 additions and 29 deletions
-3
View File
@@ -2,7 +2,6 @@ use winreg::enums::*;
use winreg::RegKey;
/// 检测当前进程是否有管理员权限(尝试写入系统注册表键)
pub fn check_admin() -> bool {
let hklm = RegKey::predef(HKEY_LOCAL_MACHINE);
hklm.open_subkey_with_flags(
@@ -23,7 +22,6 @@ pub fn validate_path(path: &str) -> bool {
}
/// 展开路径中的环境变量(如 %JAVA_HOME%\bin → C:\Program Files\Java\jdk-17\bin
pub fn expand_env_vars(path: &str) -> String {
if !path.contains('%') {
return path.to_string();
@@ -64,7 +62,6 @@ pub fn expand_env_vars(path: &str) -> String {
}
/// 广播环境变量更改通知(WM_SETTINGCHANGE
pub fn broadcast_env_change() {
const HWND_BROADCAST: isize = 0xFFFF;
const WM_SETTINGCHANGE: u32 = 0x001A;