fix(clippy): replace type annotation with type alias + .insert() to avoid trivial_cast

- Use type alias ExtDispatch for the HashMap type (fixes type_complexity)
- Use .insert() instead of HashMap::from([...]) to avoid fn ptr trivial casts
- Remove all as fn(...) casts to avoid clippy::trivial_casts
This commit is contained in:
Cyrene (Mem)
2026-07-22 14:29:50 +07:00
parent 883908ab55
commit ffefa8c07f
@@ -286,17 +286,17 @@ impl SymbolIndex {
let walker = ignore::Walk::new(path); let walker = ignore::Walk::new(path);
// Pre-compile per-extension dispatch table. // Pre-compile per-extension dispatch table.
let ext_dispatch = HashMap::from([ type ExtDispatch = HashMap<&'static str, fn(&str, &str) -> Vec<CodeSymbol>>;
("rs", extract_rust as fn(&str, &str) -> Vec<CodeSymbol>), let mut ext_dispatch = ExtDispatch::new();
("ts", extract_typescript as fn(&str, &str) -> Vec<CodeSymbol>), ext_dispatch.insert("rs", extract_rust);
("tsx", extract_typescript as fn(&str, &str) -> Vec<CodeSymbol>), ext_dispatch.insert("ts", extract_typescript);
("mts", extract_typescript as fn(&str, &str) -> Vec<CodeSymbol>), ext_dispatch.insert("tsx", extract_typescript);
("js", extract_javascript as fn(&str, &str) -> Vec<CodeSymbol>), ext_dispatch.insert("mts", extract_typescript);
("jsx", extract_javascript as fn(&str, &str) -> Vec<CodeSymbol>), ext_dispatch.insert("js", extract_javascript);
("mjs", extract_javascript as fn(&str, &str) -> Vec<CodeSymbol>), ext_dispatch.insert("jsx", extract_javascript);
("py", extract_python as fn(&str, &str) -> Vec<CodeSymbol>), ext_dispatch.insert("mjs", extract_javascript);
("go", extract_go as fn(&str, &str) -> Vec<CodeSymbol>), ext_dispatch.insert("py", extract_python);
]); ext_dispatch.insert("go", extract_go);
for entry in walker.flatten() { for entry in walker.flatten() {
let file_path = entry.path(); let file_path = entry.path();