fix(rust): resolve all clippy warnings treated as errors in CI

Fix 18 clippy errors across 7 files:
- lib.rs: change doc comment to regular comment (empty line after doc)
- arch_audit.rs: replace format!() with string literal, use is_none_or
- code_quality.rs: collapsible if, map_or → is_none_or
- commit.rs: collapsible match guard
- explore.rs: needless_range_loop → iterator enumerate
- skills.rs: map_or(false,...) → is_some_and
- semantic_search.rs: map_or → is_none_or, sort_by → sort_by_key,
  remove explicit type to avoid type_complexity

CI was failing with 'error: could not compile zesdex-infrastructure
due to 18 previous errors' at clippy step.
This commit is contained in:
Cyrene (Mem)
2026-07-22 14:16:56 +07:00
parent 958645ed7f
commit 6b90c7eb0d
7 changed files with 48 additions and 50 deletions
@@ -286,7 +286,7 @@ impl SymbolIndex {
let walker = ignore::Walk::new(path);
// Pre-compile per-extension dispatch table.
let ext_dispatch: HashMap<&str, fn(&str, &str) -> Vec<CodeSymbol>> = HashMap::from([
let ext_dispatch = HashMap::from([
("rs", extract_rust as fn(&str, &str) -> Vec<CodeSymbol>),
("ts", extract_typescript as fn(&str, &str) -> Vec<CodeSymbol>),
("tsx", extract_typescript as fn(&str, &str) -> Vec<CodeSymbol>),
@@ -385,9 +385,9 @@ impl SymbolIndex {
.symbols
.iter()
.filter(|s| {
language_filter.as_ref().map_or(true, |l| s.language == *l)
&& kind_filter.as_ref().map_or(true, |k| s.kind == *k)
&& file_filter.map_or(true, |f| s.file.contains(f))
language_filter.as_ref().is_none_or(|l| s.language == *l)
&& kind_filter.as_ref().is_none_or(|k| s.kind == *k)
&& file_filter.is_none_or(|f| s.file.contains(f))
})
.take(max_results)
.collect();
@@ -401,7 +401,7 @@ impl SymbolIndex {
*counts.entry(sym.language.clone()).or_default() += 1;
}
let mut sorted: Vec<(Language, usize)> = counts.into_iter().collect();
sorted.sort_by(|a, b| b.1.cmp(&a.1));
sorted.sort_by_key(|b| std::cmp::Reverse(b.1));
sorted
}
@@ -412,7 +412,7 @@ impl SymbolIndex {
*counts.entry(sym.kind.clone()).or_default() += 1;
}
let mut sorted: Vec<(SymbolKind, usize)> = counts.into_iter().collect();
sorted.sort_by(|a, b| b.1.cmp(&a.1));
sorted.sort_by_key(|b| std::cmp::Reverse(b.1));
sorted
}
}
@@ -1299,8 +1299,8 @@ impl Tool for SemanticSearch {
let filtered: Vec<&&CodeSymbol> = results
.iter()
.filter(|s| target_kind.as_ref().map_or(true, |k| s.kind == *k))
.filter(|s| target_lang.as_ref().map_or(true, |l| s.language == *l))
.filter(|s| target_kind.as_ref().is_none_or(|k| s.kind == *k))
.filter(|s| target_lang.as_ref().is_none_or(|l| s.language == *l))
.take(max_results)
.collect();