From efa1edd079b259b0b1f77b835151ee904437a231 Mon Sep 17 00:00:00 2001 From: Hamza Naveed <45464935+Hamza0101@users.noreply.github.com> Date: Sat, 17 Oct 2026 19:39:15 +0500 Subject: [PATCH] algo: gate the recorded-hash test's helpers with the test (#7053) `blocks` and `fnv` exist only for `harris_and_describe_hashes_recorded_from_the _serial_code`, which is `#[cfg(all(target_os = "linux", target_arch = "x86_64"))]` because the hashes it compares against go through the platform's hypot / ln / cos / atan2 / sin_cos. Everywhere else the test is compiled out and the two helpers are left unused, so `-D warnings` fails on `dead_code`: error: function `blocks` is never used crates/algo/src/features.rs:704 error: function `fnv` is never used crates/algo/src/features.rs:708 They now carry the same cfg as the only thing that calls them. CI's matrix is ubuntu-latest and windows-latest and runs clippy on both, so this fails the Windows leg as much as a local run on macOS: `target_os = "linux"` is false for both. --- crates/algo/src/features.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/algo/src/features.rs b/crates/algo/src/features.rs index e8e45bcaf2..ec74891074 100644 --- a/crates/algo/src/features.rs +++ b/crates/algo/src/features.rs @@ -700,11 +700,14 @@ mod parallel_tests { .collect() } - /// Blocks of random brightness: lots of strong corners, no libm in the making. + /// Blocks of random brightness: lots of strong corners, no libm in the making. Only the + /// recorded-hash test below uses it, and that one is Linux x86_64 only. + #[cfg(all(target_os = "linux", target_arch = "x86_64"))] fn blocks(w: usize, h: usize, seed: u64) -> Vec { (0..w * h).map(|i| (mix(seed + ((i % w) / 8) as u64 * 4096 + ((i / w) / 8) as u64) >> 40) as f32 / 16_777_216.0).collect() } + #[cfg(all(target_os = "linux", target_arch = "x86_64"))] fn fnv(parts: &[u64]) -> u64 { let mut h = 0xcbf2_9ce4_8422_2325u64; for p in parts {