fix: 修复所有 Clippy 警告,CI 质量门禁全部通过

- agent.rs: !...is_some() → .is_none() (nonminimal_bool)
- config.rs: 去掉 macOS/Windows 块多余 return (needless_return)
- config.rs: &old_pkg → old_pkg (needless_borrow)
- logs.rs: 第二处 saturating_sub + filter_map → map_while (lines_filter_map_ok)
- memory.rs: 两处 for/if-let → .iter().flatten() (manual_flatten)
- tray.rs: let _ = future → std::mem::drop (let_underscore_future)
This commit is contained in:
晴天
2026-03-04 12:43:48 +08:00
parent c096ba143c
commit d8084f9213
5 changed files with 23 additions and 25 deletions

View File

@@ -121,12 +121,10 @@ pub async fn read_memory_file(path: String, agent_id: Option<String>) -> Result<
memory_dir_for_agent(aid, "core").await,
];
for c in &candidates {
if let Ok(dir) = c {
let full = dir.join(&path);
if full.exists() {
return fs::read_to_string(&full).map_err(|e| format!("读取失败: {e}"));
}
for dir in candidates.iter().flatten() {
let full = dir.join(&path);
if full.exists() {
return fs::read_to_string(&full).map_err(|e| format!("读取失败: {e}"));
}
}
@@ -168,12 +166,10 @@ pub async fn delete_memory_file(path: String, agent_id: Option<String>) -> Resul
memory_dir_for_agent(aid, "core").await,
];
for c in &candidates {
if let Ok(dir) = c {
let full = dir.join(&path);
if full.exists() {
return fs::remove_file(&full).map_err(|e| format!("删除失败: {e}"));
}
for dir in candidates.iter().flatten() {
let full = dir.join(&path);
if full.exists() {
return fs::remove_file(&full).map_err(|e| format!("删除失败: {e}"));
}
}