You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(lints+docs): clippy clean on graduated modules + rustdoc examples
Two CI / review-feedback fixes on PR #194:
1) Clippy (`-D warnings`, --features rayon / approx,serde,rayon):
10 errors surfaced because the graduated modules are no longer
under hpc/mod.rs's `#![allow(clippy::all, ...)]` umbrella.
Fixed each at the canonical Rust idiom rather than re-applying
the umbrella — graduated modules hold to the higher standard:
- `bitwise.rs:110,155` — `acc = acc + (x + y);` →
`acc += x + y;` (assign_op_pattern; bare without parens).
- `distance.rs:99` — `for j in i..n { points[j] }` →
`for p in &points[i..n] { p[0]..p[2] }` (needless_range_loop).
- `byte_scan.rs:38,71` — `for j in i..n { if haystack[j] == needle
{ result.push(j); }}` → `for (offset, &byte) in haystack[i..n]
.iter().enumerate() { if byte == needle { result.push(i + offset);
}}` (needless_range_loop with index preservation).
- `byte_scan.rs:101,129` — same pattern but counting via
`total += 1`; switched to `for &byte in &haystack[i..n]`
(no index needed at all).
- `spatial_hash.rs:334` — `for lane in 0..8 { d2_arr[lane] }` →
`for (lane, &d2_lane) in d2_arr.iter().enumerate()`.
- `spatial_hash.rs:342` — `for i in (chunks*8)..candidates.len()
{ candidates[i] }` → `let tail_start = chunks * 8;
for (offset, &cand) in candidates[tail_start..].iter()
.enumerate() { result.push((tail_start + offset, d2)) }`.
2) CodeRabbit + CLAUDE.md hard rule ("All public APIs need ///
doc comments with examples"):
Added `# Example` rustdoc blocks to each of the five new
`pub mod` declarations in `src/lib.rs`. Each example uses
only the actual public API of the target module (verified by
running the doctests):
- `bitwise` — popcount + hamming over [0xFF; 16]/[0x00; 16]
- `heel_f64x8` — cosine_f64_simd + dot_f64_simd over [1.0; 32]
- `distance` — l1/l2/linf_f64_simd over pythagorean (3,0)/(0,4)
- `byte_scan` — byte_find_all over a 23-char fixture
- `spatial_hash` — SpatialHash::new + insert + len
All five doctests pass under `cargo test --doc`. `cargo clippy
--features rayon --lib -- -D warnings` and `cargo clippy
--features approx,serde,rayon -- -D warnings` both green.
0 commit comments