From ffefa8c07facbba83778f426ca4715569556b08a Mon Sep 17 00:00:00 2001 From: "Cyrene (Mem)" Date: Wed, 22 Jul 2026 14:29:44 +0700 Subject: [PATCH] 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 --- .../src/tools/semantic_search.rs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/infrastructure/src/tools/semantic_search.rs b/apps/infrastructure/src/tools/semantic_search.rs index b2a9b7e..d31a4f4 100644 --- a/apps/infrastructure/src/tools/semantic_search.rs +++ b/apps/infrastructure/src/tools/semantic_search.rs @@ -286,17 +286,17 @@ impl SymbolIndex { let walker = ignore::Walk::new(path); // Pre-compile per-extension dispatch table. - let ext_dispatch = HashMap::from([ - ("rs", extract_rust as fn(&str, &str) -> Vec), - ("ts", extract_typescript as fn(&str, &str) -> Vec), - ("tsx", extract_typescript as fn(&str, &str) -> Vec), - ("mts", extract_typescript as fn(&str, &str) -> Vec), - ("js", extract_javascript as fn(&str, &str) -> Vec), - ("jsx", extract_javascript as fn(&str, &str) -> Vec), - ("mjs", extract_javascript as fn(&str, &str) -> Vec), - ("py", extract_python as fn(&str, &str) -> Vec), - ("go", extract_go as fn(&str, &str) -> Vec), - ]); + type ExtDispatch = HashMap<&'static str, fn(&str, &str) -> Vec>; + let mut ext_dispatch = ExtDispatch::new(); + ext_dispatch.insert("rs", extract_rust); + ext_dispatch.insert("ts", extract_typescript); + ext_dispatch.insert("tsx", extract_typescript); + ext_dispatch.insert("mts", extract_typescript); + ext_dispatch.insert("js", extract_javascript); + ext_dispatch.insert("jsx", extract_javascript); + ext_dispatch.insert("mjs", extract_javascript); + ext_dispatch.insert("py", extract_python); + ext_dispatch.insert("go", extract_go); for entry in walker.flatten() { let file_path = entry.path();