Skip to content

Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.

fix(clippy): silence chunks_exact_to_as_chunks, keeping the 1.85 MSRV (#107)

Nicolas2aa9b6393531
diff --git a/src/vecstore.rs b/src/vecstore.rs
index 3ab00a54..b1501dad 100644
--- a/src/vecstore.rs
+++ b/src/vecstore.rs
@@ -962,6 +962,13 @@ fn f32_slice_to_bytes(v: &[f32]) -> Vec<u8> {
v.iter().flat_map(|f| f.to_le_bytes()).collect()
}
+// clippy::chunks_exact_to_as_chunks suggests `as_chunks::<4>()`, but that was
+// only stabilized in Rust 1.88, and this crate advertises a Rust 1.85 minimum
+// (README, edition 2024). `chunks_exact` has been stable since 1.31 and decodes
+// identically — it drops the same trailing remainder — so keep it and silence
+// the lint rather than raise the effective compiler requirement for every
+// embeddings build.
+#[allow(clippy::chunks_exact_to_as_chunks)]
fn bytes_to_f32_vec(b: &[u8]) -> Vec<f32> {
b.chunks_exact(4)
.map(|c| f32::from_le_bytes([c[0], c[1], c[2], c[3]]))
diff --git a/tests/turbovec_index_test.rs b/tests/turbovec_index_test.rs
index b44e772b..0cb1696c 100644
--- a/tests/turbovec_index_test.rs
+++ b/tests/turbovec_index_test.rs
@@ -526,6 +526,9 @@ fn measure_recall_on_a_real_corpus() {
// Embed once, cache to disk. The cache is keyed by the labels file and the
// count, so a different slice does not silently reuse the wrong vectors.
let cache_path = labels_path.with_extension(format!("{n}.f32"));
+ // Same 1.85-MSRV reasoning as vecstore::bytes_to_f32_vec: clippy suggests
+ // as_chunks, stabilized only in Rust 1.88; chunks_exact is stable since 1.31.
+ #[allow(clippy::chunks_exact_to_as_chunks)]
let flat: Vec<f32> = if cache_path.exists() {
let raw = std::fs::read(&cache_path).unwrap();
raw.chunks_exact(4)