Skip to content

Commit 31d7757

Browse files
committed
fix(blasgraph): silence dead_code for scalar Hamming fallback under ndarray-hpc
After routing `hamming_distance_dispatch` through `ndarray::hpc::bitwise`, the in-crate `hamming_distance_scalar` is reached only from the `not(ndarray-hpc)` fallback and `#[cfg(test)]` parity tests — so a non-test build with the default `ndarray-hpc` feature warns it's unused. `#[cfg_attr(feature = "ndarray-hpc", allow(dead_code))]` keeps the lib build warning-free while leaving it live for the fallback and tests. https://claude.ai/code/session_01D2WSmezQBNC3bUdHuGfGmo
1 parent e770a7c commit 31d7757

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • crates/lance-graph/src/graph/blasgraph

crates/lance-graph/src/graph/blasgraph/types.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,10 @@ pub enum SelectOp {
429429
/// Scalar fallback: portable popcount via `count_ones()`.
430430
///
431431
/// Used as the `#[cfg(not(feature = "ndarray-hpc"))]` Hamming path and by the
432-
/// in-crate parity tests.
432+
/// in-crate parity tests. Under `ndarray-hpc` (the default) the dispatch routes
433+
/// through `ndarray::hpc::bitwise`, so this is reachable only from `#[cfg(test)]`
434+
/// then — `allow(dead_code)` keeps the non-test lib build warning-free.
435+
#[cfg_attr(feature = "ndarray-hpc", allow(dead_code))]
433436
fn hamming_distance_scalar(a: &[u64; VECTOR_WORDS], b: &[u64; VECTOR_WORDS]) -> u32 {
434437
let mut dist = 0u32;
435438
for i in 0..VECTOR_WORDS {

0 commit comments

Comments
 (0)