From 65ce69800283a41315a0d6e59d6b50f8e8d5592d Mon Sep 17 00:00:00 2001 From: Harsha Vardhan Simhadri Date: Tue, 14 Jul 2026 17:31:35 -0700 Subject: [PATCH] Upgrade Rust toolchain to 1.95 and fix clippy lints Bump the pinned toolchain from 1.92 to 1.95 and resolve the clippy warnings that surface under 1.95 (all CI clippy jobs run with -Dwarnings): - useless_conversion: drop redundant .into_iter() calls in the benchmark, disk, and wide test helpers. - collapsible_match: fold the nested trained-check into a match guard in the Garnet provider's train_quantizer. - manual_checked_ops: allow the false positive in DiskSectorGraph::node_sector_index, where the else branch is genuine multi-sector layout logic rather than a divide-by-zero guard. Also refresh the toolchain reference in agents.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c751fafd-79be-47e2-9f20-7f1934f4d6e7 --- agents.md | 2 +- diskann-benchmark-runner/src/internal/regression.rs | 2 +- diskann-benchmark/src/index/search/knn.rs | 6 +++--- diskann-benchmark/src/index/search/range.rs | 2 +- diskann-disk/src/search/provider/disk_provider.rs | 6 ++---- .../src/search/provider/disk_sector_graph.rs | 3 +++ diskann-garnet/src/provider.rs | 13 ++++--------- diskann-wide/src/test_utils/dot_product.rs | 6 +++--- rust-toolchain.toml | 2 +- 9 files changed, 19 insertions(+), 23 deletions(-) diff --git a/agents.md b/agents.md index 244df150d..3c38b1468 100644 --- a/agents.md +++ b/agents.md @@ -1,6 +1,6 @@ # DiskANN Repository - Agent Onboarding Guide -**Last Updated**: 2026-02-11 (based on v0.45.0, Rust 1.92) +**Last Updated**: 2026-07-14 (based on v0.45.0, Rust 1.95) This guide helps coding agents understand how to work efficiently with the DiskANN repository. diff --git a/diskann-benchmark-runner/src/internal/regression.rs b/diskann-benchmark-runner/src/internal/regression.rs index 2f9148514..75918a604 100644 --- a/diskann-benchmark-runner/src/internal/regression.rs +++ b/diskann-benchmark-runner/src/internal/regression.rs @@ -229,7 +229,7 @@ impl<'a> Checks<'a> { // We can now package everything together! debug_assert_eq!(input_to_parsed.len(), inputs.jobs().len()); - let checks = std::iter::zip(inputs.into_inner(), input_to_parsed.into_iter()) + let checks = std::iter::zip(inputs.into_inner(), input_to_parsed) .map(|(input, index)| { // This index should always be inbounds. let inner = &parsed.inner[index]; diff --git a/diskann-benchmark/src/index/search/knn.rs b/diskann-benchmark/src/index/search/knn.rs index 14f426f46..fa2944438 100644 --- a/diskann-benchmark/src/index/search/knn.rs +++ b/diskann-benchmark/src/index/search/knn.rs @@ -108,7 +108,7 @@ where ) -> anyhow::Result> { let results = core_search::search_all( self.clone(), - parameters.into_iter(), + parameters, core_search::graph::knn::Aggregator::new( groundtruth, recall_k, @@ -140,7 +140,7 @@ where ) -> anyhow::Result> { let results = core_search::search_all( self.clone(), - parameters.into_iter(), + parameters, core_search::graph::knn::Aggregator::new( groundtruth, recall_k, @@ -172,7 +172,7 @@ where ) -> anyhow::Result> { let results = core_search::search_all( self.clone(), - parameters.into_iter(), + parameters, core_search::graph::knn::Aggregator::new( groundtruth, recall_k, diff --git a/diskann-benchmark/src/index/search/range.rs b/diskann-benchmark/src/index/search/range.rs index 9224f69e9..e78c1f330 100644 --- a/diskann-benchmark/src/index/search/range.rs +++ b/diskann-benchmark/src/index/search/range.rs @@ -90,7 +90,7 @@ where ) -> anyhow::Result> { let results = core_search::search_all( self.clone(), - parameters.into_iter(), + parameters, core_search::graph::range::Aggregator::new(groundtruth), )?; diff --git a/diskann-disk/src/search/provider/disk_provider.rs b/diskann-disk/src/search/provider/disk_provider.rs index c497414a6..e8ff0dc65 100644 --- a/diskann-disk/src/search/provider/disk_provider.rs +++ b/diskann-disk/src/search/provider/disk_provider.rs @@ -1075,10 +1075,8 @@ where stats, }; - for ((vertex_id, distance), associated_data) in indices - .into_iter() - .zip(distances.into_iter()) - .zip(associated_data.into_iter()) + for ((vertex_id, distance), associated_data) in + indices.into_iter().zip(distances).zip(associated_data) { search_result.results.push(SearchResultItem { vertex_id, diff --git a/diskann-disk/src/search/provider/disk_sector_graph.rs b/diskann-disk/src/search/provider/disk_sector_graph.rs index 68a47eb92..834f46ec7 100644 --- a/diskann-disk/src/search/provider/disk_sector_graph.rs +++ b/diskann-disk/src/search/provider/disk_sector_graph.rs @@ -179,6 +179,9 @@ impl DiskSectorGraph { #[inline] /// Gets the index for the sector that contains the node with the given vertex_id + // The `else` branch is not a divide-by-zero guard: for the multiple-sectors-per-node + // layout it computes a genuinely different index, so `checked_div` does not model this. + #[allow(clippy::manual_checked_ops)] pub fn node_sector_index(&self, vertex_id: u32) -> u64 { 1 + if self.num_nodes_per_sector > 0 { vertex_id as u64 / self.num_nodes_per_sector diff --git a/diskann-garnet/src/provider.rs b/diskann-garnet/src/provider.rs index 08eeef13e..f4f8e7e52 100644 --- a/diskann-garnet/src/provider.rs +++ b/diskann-garnet/src/provider.rs @@ -437,15 +437,10 @@ impl GarnetProvider { }; let quantizer = match &self.quantizer { - Some(q) => { - if !q.is_trained() { - q - } else { - // Quantizer already trained, bail. - return false; - } - } - None => return false, + // Only proceed when there is an untrained quantizer; a missing or + // already-trained quantizer means there is nothing to do, so bail. + Some(q) if !q.is_trained() => q, + _ => return false, }; let rows = quantizer.required_vectors(); diff --git a/diskann-wide/src/test_utils/dot_product.rs b/diskann-wide/src/test_utils/dot_product.rs index 0b97df6d9..f0424a023 100644 --- a/diskann-wide/src/test_utils/dot_product.rs +++ b/diskann-wide/src/test_utils/dot_product.rs @@ -297,7 +297,7 @@ mod tests { for right in b { let dot: i32 = (*left) .into_iter() - .zip((*right).into_iter()) + .zip(*right) .map(|(l, r)| (l as i32) * (r as i32)) .sum(); for b in bases { @@ -333,7 +333,7 @@ mod tests { for right in a { let dot: i32 = (*left) .into_iter() - .zip((*right).into_iter()) + .zip(*right) .map(|(l, r)| (l as i32) * (r as i32)) .sum(); for b in bases { @@ -370,7 +370,7 @@ mod tests { for right in a { let dot: u32 = (*left) .into_iter() - .zip((*right).into_iter()) + .zip(*right) .map(|(l, r)| (l as u32) * (r as u32)) .sum(); for b in bases { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 50b3f5d47..4933b3ba1 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.92" +channel = "1.95"