From f8d6180f06fcc089cdcb1528b9bc0d56bc974a78 Mon Sep 17 00:00:00 2001 From: teernisse Date: Wed, 18 Feb 2026 22:56:16 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20clippy=20lints=20=E2=80=94=20sort=5Fby?= =?UTF-8?q?=5Fkey=20in=20drift,=20pub=20visibility=20for=20TUI,=20assert?= =?UTF-8?q?=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - drift.rs: Replace `sorted.sort_by(|a, b| b.1.cmp(&a.1))` with idiomatic `sort_by_key(|entry| std::cmp::Reverse(entry.1))` (clippy::use_sort_by_key). - list.rs: Change `query_issues` and `query_mrs` from `fn` to `pub fn` so the TUI crate can call them directly instead of duplicating the query logic. - vector.rs: Reformat multi-line assert! macro to satisfy rustfmt check (body moved onto separate lines with trailing message string). --- src/cli/commands/drift.rs | 2 +- src/cli/commands/list.rs | 4 ++-- src/search/vector.rs | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cli/commands/drift.rs b/src/cli/commands/drift.rs index de85018..59d6dd4 100644 --- a/src/cli/commands/drift.rs +++ b/src/cli/commands/drift.rs @@ -382,7 +382,7 @@ fn extract_drift_topics(description: &str, notes: &[NoteRow], drift_idx: usize) } let mut sorted: Vec<(String, usize)> = freq.into_iter().collect(); - sorted.sort_by(|a, b| b.1.cmp(&a.1)); + sorted.sort_by_key(|entry| std::cmp::Reverse(entry.1)); sorted .into_iter() diff --git a/src/cli/commands/list.rs b/src/cli/commands/list.rs index 65b7bf3..5dee0bd 100644 --- a/src/cli/commands/list.rs +++ b/src/cli/commands/list.rs @@ -253,7 +253,7 @@ fn query_available_statuses(conn: &Connection) -> Result> { Ok(statuses) } -fn query_issues(conn: &Connection, filters: &ListFilters) -> Result { +pub fn query_issues(conn: &Connection, filters: &ListFilters) -> Result { let mut where_clauses = Vec::new(); let mut params: Vec> = Vec::new(); @@ -450,7 +450,7 @@ pub fn run_list_mrs(config: &Config, filters: MrListFilters) -> Result Result { +pub fn query_mrs(conn: &Connection, filters: &MrListFilters) -> Result { let mut where_clauses = Vec::new(); let mut params: Vec> = Vec::new(); diff --git a/src/search/vector.rs b/src/search/vector.rs index 5fc0633..08c744b 100644 --- a/src/search/vector.rs +++ b/src/search/vector.rs @@ -153,7 +153,10 @@ mod tests { // The original bug: limit=1500 (RECALL_CAP) with multiplier >= 8 // produced k=10_000 which exceeded sqlite-vec's 4096 cap. let k = compute_knn_k(1500, 1); - assert!(k <= SQLITE_VEC_KNN_MAX, "k={k} exceeded 4096 at RECALL_CAP with 1 chunk"); + assert!( + k <= SQLITE_VEC_KNN_MAX, + "k={k} exceeded 4096 at RECALL_CAP with 1 chunk" + ); } #[test]