chore: 修复 clippy error(loop never loops → if-let)并应用自动修复

This commit is contained in:
2026-06-10 10:27:27 +08:00
parent a49d8ac423
commit ec42c3dcdb
18 changed files with 72 additions and 142 deletions
+2 -3
View File
@@ -106,8 +106,8 @@ pub async fn trigger_idle_summary(
/// 生成摘要:优先使用 LLM,不可用时回退到简单截断
async fn generate_summary(messages: &[Message], summarizer: Option<&Summarizer>) -> String {
if let Some(summarizer) = summarizer {
if messages.len() >= 3 {
if let Some(summarizer) = summarizer
&& messages.len() >= 3 {
let prompt = build_summary_prompt(messages);
match summarizer(prompt).await {
Ok(text) if !text.is_empty() => {
@@ -117,7 +117,6 @@ async fn generate_summary(messages: &[Message], summarizer: Option<&Summarizer>)
_ => tracing::warn!("LLM 摘要失败,回退到简单截断"),
}
}
}
summarize_messages(messages)
}