Author SHA1 Message Date
Omar Sobh bb44edcf90 refactor: clippy fixes (assign_op, type_complexity, unnecessary max)
Resolve -D warnings under Rust 1.95 clippy:

- simd_cdc.rs: use compound assignment in unit test; document and
  scope-allow too_many_arguments on the SIMD inner-loop helper
  (each parameter is a distinct cursor/limit on the hot path).
- merkle.rs: drop `(usize).max(0)` which is always \u22650.
- benches: factor `fn(usize) -> Vec<u8>` into a `DataGen` type alias
  to satisfy clippy::type_complexity.

No behavioral changes; all workspace tests pass.
2026-05-19 15:09:06 -07:00
4 changed files with 10 additions and 4 deletions
+2 -1
View File
@@ -73,7 +73,8 @@ fn bench_compress(data: &[u8], codec: Codec) -> usize {
fn bench_tdt_compress(c: &mut Criterion) { fn bench_tdt_compress(c: &mut Criterion) {
let sizes = [4096usize, 65536]; let sizes = [4096usize, 65536];
let datasets: &[(&str, fn(usize) -> Vec<u8>, usize)] = &[ type DataGen = fn(usize) -> Vec<u8>;
let datasets: &[(&str, DataGen, usize)] = &[
("f32_smooth", make_f32_smooth, 4), ("f32_smooth", make_f32_smooth, 4),
("f32_random", make_f32_random, 4), ("f32_random", make_f32_random, 4),
("int32_random", make_int32_random, 4), ("int32_random", make_int32_random, 4),
+1 -1
View File
@@ -540,7 +540,7 @@ mod tests {
let all_entries: Vec<(u64, [u8; 32])> = (0..total as u64) let all_entries: Vec<(u64, [u8; 32])> = (0..total as u64)
.map(|r| (r, rev_hash(r))) .map(|r| (r, rev_hash(r)))
.collect(); .collect();
let keep_count = ((total as f64 * keep_frac) as usize).max(0); let keep_count = (total as f64 * keep_frac) as usize;
let remote_entries = &all_entries[..keep_count]; let remote_entries = &all_entries[..keep_count];
let local = RevisionMerkleTree::build(&all_entries); let local = RevisionMerkleTree::build(&all_entries);
+3 -1
View File
@@ -58,8 +58,10 @@ fn cold_data(n: usize) -> Vec<u8> {
// Benchmark // Benchmark
// ───────────────────────────────────────────────────────────────────────────── // ─────────────────────────────────────────────────────────────────────────────
type DataGen = fn(usize) -> Vec<u8>;
fn bench_cdc(c: &mut Criterion) { fn bench_cdc(c: &mut Criterion) {
let datasets: &[(&str, fn(usize) -> Vec<u8>)] = &[ let datasets: &[(&str, DataGen)] = &[
("random", random_data), ("random", random_data),
("float", float_data), ("float", float_data),
("cold_only", cold_data), ("cold_only", cold_data),
+4 -1
View File
@@ -151,6 +151,9 @@ pub fn chunk_scalar(data: &[u8], min: usize, avg: usize, max: usize) -> Vec<Chun
/// Scalar processing for a single 16-byte (or shorter) slice, folding the /// Scalar processing for a single 16-byte (or shorter) slice, folding the
/// updated hash back out. Used by both SIMD paths when a hot byte is detected. /// updated hash back out. Used by both SIMD paths when a hot byte is detected.
#[inline(always)] #[inline(always)]
// Hot SIMD inner-loop helper: each arg is a distinct cursor/limit; bundling
// into a struct would add per-call overhead in the chunker fast path.
#[allow(clippy::too_many_arguments)]
fn scalar_window( fn scalar_window(
data: &[u8], data: &[u8],
window: &[u8], window: &[u8],
@@ -542,7 +545,7 @@ mod tests {
let original = chunk_data_simd(&data); let original = chunk_data_simd(&data);
// Flip a hot byte in the middle to force a different boundary // Flip a hot byte in the middle to force a different boundary
let mid = 150_000; let mid = 150_000;
data[mid] = data[mid] & 0x3F; // ensure it's a hot byte (< 64) data[mid] &= 0x3F; // ensure it's a hot byte (< 64)
data[mid] ^= 0x11; data[mid] ^= 0x11;
let mutated = chunk_data_simd(&data); let mutated = chunk_data_simd(&data);
assert_ne!(original, mutated, "mutation should change chunk boundaries"); assert_ne!(original, mutated, "mutation should change chunk boundaries");