Skip to content

Run Clippy in release mode in CI and fix a release-only unused import - #1516

Merged
Alex Razumov (arrayka) merged 6 commits into
mainfrom
u/arrayka/clippy_release_in_ci
Oct 30, 2026
Merged

Alex Razumov (arrayka) merged 6 commits into
mainfrom
u/arrayka/clippy_release_in_ci

Conversation

@arrayka

@arrayka Alex Razumov (arrayka) commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Why

CI only ran Clippy with debug assertions enabled, missing a release-only unused import in the disk index builder.

What

  • Add release-mode Clippy alongside all existing CI checks, preserving feature and platform coverage.

  • Fixed RUST_CONFIG: 'target."cfg(all())".rustflags=["-Dwarnings"]':

cargo check --locked --offline -p diskann-disk --lib --release --config 'build.rustflags=["-Dwarnings"]'

Printed warning: unused import: debug and succeeded (exit 0).

cargo check --locked --offline -p diskann-disk --lib --release --config 'target."cfg(all())".rustflags=["-Dwarnings"]'

Printed error: unused import: debug, noting that -D unused-imports is implied by -D warnings, and failed (exit 101).

  • Added missing --config "$RUST_CONFIG" to cargo run, cargo build, cargo miri, cargo llvm-lines. I intentionally left the baseline versions of llvm-lines and disk-benchmarks.yml untouched, because they compile main branch, which still contains unfixed code.

  • Gate the tracing::debug import with #[cfg(debug_assertions)] to fix the clippy error in --release:

cargo clippy --locked --workspace --all-targets --no-deps --release --config 'build.rustflags=["-Dwarnings"]' -- -Dwarnings
...
error: unused import: `debug`                                                                                                                                                                      
  --> diskann-disk\src\build\builder\build.rs:31:15
   |
31 | use tracing::{debug, info};
   |               ^^^^^
   |
   = note: `-D unused-imports` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unused_imports)]`

    Checking diskann-benchmark v0.61.0 (C:\src\DiskANN2\diskann-benchmark)                                                                                                                         
error: could not compile `diskann-disk` (lib) due to 1 previous error  
  • Fixed a miri-related unused import discovered by the hardenning:
error: unused import: `test_util::Check`
   --> diskann-quantization/src/algorithms/transforms/padding_hadamard.rs:372:41
    |
372 |     use crate::{alloc::GlobalAllocator, test_util::Check};
    |                                         ^^^^^^^^^^^^^^^^
    |
    = note: `-D unused-imports` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unused_imports)]`

error: variant `Ulp` is never constructed
   --> diskann-quantization/src/test_util.rs:211:5
    |
209 | pub(crate) enum Check {
    |                 ----- variant in this enum
210 |     /// Assert two floating point numbers are within a set number of ULPs oeachother.
211 |     Ulp(usize),
    |     ^^^
    |
    = note: `Check` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis
    = note: `-D dead-code` implied by `-D warnings`
    = help: to override `-D warnings` add `#[expect(dead_code)]` or `#[allow(dead_code)]`

error: associated function `ulp` is never used
   --> diskann-quantization/src/test_util.rs:228:25
    |
227 | impl Check {
    | ---------- associated function in this implementation
228 |     pub(crate) const fn ulp(ulp: usize) -> Self {
    |                         ^^^

Next

  • Add --config "$RUST_CONFIG" to baseline versions of llvm-lines and disk-benchmarks.yml
  • Run manuall, nightly.yml

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes preserve existing CI coverage, align the import guard with its usage, and have no unresolved findings.

No open issues 🎉

What changed in this PR

This PR adds release-mode Clippy checks to DiskANN’s CI and fixes the release-only unused import that motivated the change.

Changes:

  • Add release-mode Clippy alongside existing checks, preserving feature and platform coverage.
  • Gate the tracing::debug import with #[cfg(debug_assertions)] to match its usage.
File Description
diskann-disk/​src/​build/​builder/​build.rs Conditionally imports debug to avoid release-only warnings.
.github/​workflows/​ci.yml Adds release-mode Clippy for workspace, feature-specific, and vectorset checks.

Review effort: Balanced

@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.03%. Comparing base (7aed6c2) to head (a8c8242).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1516      +/-   ##
==========================================
- Coverage   92.06%   91.03%   -1.04%     
==========================================
  Files         602      602              
  Lines      124080   124080              
==========================================
- Hits       114233   112951    -1282     
- Misses       9847    11129    +1282     
Flag Coverage Δ
miri 91.03% <ø> (-1.04%) ⬇️
unittests 90.73% <ø> (-1.28%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
diskann-disk/src/build/builder/build.rs 92.79% <ø> (ø)
...tion/src/algorithms/transforms/padding_hadamard.rs 97.83% <ø> (ø)
diskann-quantization/src/test_util.rs 85.38% <ø> (ø)

... and 53 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hildebrandmw

Copy link
Copy Markdown
Contributor

Was the dependencies comment meant to go on #1517?

@arrayka
Alex Razumov (arrayka) merged commit 3bcb584 into main Oct 30, 2026
31 checks passed
@arrayka
Alex Razumov (arrayka) deleted the u/arrayka/clippy_release_in_ci branch October 30, 2026 19:45
Alex Razumov (arrayka) added a commit that referenced this pull request Nov 2, 2026
This is a follow-up to #1516.

This PR enables `--config "$RUST_CONFIG"` for the baseline versions of
llvm-lines and disk-benchmarks.yml.

This was intentionally omitted from #1516 because the baseline versions
run code from the `main` branch, which did not yet contain the required
fixes to enable failures on warnings. Now that #1516 has landed in main,
it is safe to enable this for the baseline versions as well.
Suhas Jayaram Subramanya (suhasjs) pushed a commit that referenced this pull request Nov 3, 2026
…#1516)

## Why
CI only ran Clippy with debug assertions enabled, missing a release-only
unused import in the disk index builder.

## What
- Add release-mode Clippy alongside all existing CI checks, preserving
feature and platform coverage.

- Fixed RUST_CONFIG: 'target."cfg(all())".rustflags=["-Dwarnings"]':

```
cargo check --locked --offline -p diskann-disk --lib --release --config 'build.rustflags=["-Dwarnings"]'
```
Printed warning: unused import: debug and succeeded (exit 0).

```
cargo check --locked --offline -p diskann-disk --lib --release --config 'target."cfg(all())".rustflags=["-Dwarnings"]'
```
Printed error: unused import: debug, noting that -D unused-imports is
implied by -D warnings, and failed (exit 101).

- Added missing `--config "$RUST_CONFIG"` to `cargo run`, `cargo build`,
`cargo miri`, `cargo llvm-lines`. I intentionally left the baseline
versions of llvm-lines and disk-benchmarks.yml untouched, because they
compile `main` branch, which still contains unfixed code.

- Gate the `tracing::debug` import with `#[cfg(debug_assertions)]` to
fix the clippy error in `--release`:

```
cargo clippy --locked --workspace --all-targets --no-deps --release --config 'build.rustflags=["-Dwarnings"]' -- -Dwarnings
...
error: unused import: `debug`                                                                                                                                                                      
  --> diskann-disk\src\build\builder\build.rs:31:15
   |
31 | use tracing::{debug, info};
   |               ^^^^^
   |
   = note: `-D unused-imports` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unused_imports)]`

    Checking diskann-benchmark v0.61.0 (C:\src\DiskANN2\diskann-benchmark)                                                                                                                         
error: could not compile `diskann-disk` (lib) due to 1 previous error  
```

- Fixed a miri-related unused import discovered by the hardenning:

```
error: unused import: `test_util::Check`
   --> diskann-quantization/src/algorithms/transforms/padding_hadamard.rs:372:41
    |
372 |     use crate::{alloc::GlobalAllocator, test_util::Check};
    |                                         ^^^^^^^^^^^^^^^^
    |
    = note: `-D unused-imports` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unused_imports)]`

error: variant `Ulp` is never constructed
   --> diskann-quantization/src/test_util.rs:211:5
    |
209 | pub(crate) enum Check {
    |                 ----- variant in this enum
210 |     /// Assert two floating point numbers are within a set number of ULPs oeachother.
211 |     Ulp(usize),
    |     ^^^
    |
    = note: `Check` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis
    = note: `-D dead-code` implied by `-D warnings`
    = help: to override `-D warnings` add `#[expect(dead_code)]` or `#[allow(dead_code)]`

error: associated function `ulp` is never used
   --> diskann-quantization/src/test_util.rs:228:25
    |
227 | impl Check {
    | ---------- associated function in this implementation
228 |     pub(crate) const fn ulp(ulp: usize) -> Self {
    |                         ^^^
```

## Next

- Add `--config "$RUST_CONFIG"` to baseline versions of llvm-lines and
disk-benchmarks.yml
- Run manually nightly.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants