From 30b8f343c1aa4c2db018b5cd6738a0d6fc7f4607 Mon Sep 17 00:00:00 2001 From: "Alex Razumov (from Dev Box)" Date: Mon, 26 Oct 2026 16:14:07 -0700 Subject: [PATCH 1/4] Run Clippy in release mode in CI and fix a release-only unused import --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++- diskann-disk/src/build/builder/build.rs | 4 +++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 097892fdc..64c301704 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -141,6 +141,8 @@ jobs: - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 - name: "clippy --workspace --all-targets" run: cargo clippy --locked --workspace --all-targets --no-deps --config "$RUST_CONFIG" -- -Dwarnings + - name: "clippy --workspace --all-targets --release" + run: cargo clippy --locked --workspace --all-targets --no-deps --release --config "$RUST_CONFIG" -- -Dwarnings clippy-features: strategy: @@ -157,13 +159,24 @@ jobs: - name: Install Rust run: rustup show && rustup component add clippy - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 - - name: "clippy --workspace --all-targets" + - name: "clippy --workspace --all-targets --all-features" + run: | + set -euxo pipefail + cargo clippy --locked --workspace \ + --all-targets \ + --all-features \ + --no-deps \ + --config "$RUST_CONFIG" \ + -- -Dwarnings + + - name: "clippy --workspace --all-targets --all-features --release" run: | set -euxo pipefail cargo clippy --locked --workspace \ --all-targets \ --all-features \ --no-deps \ + --release \ --config "$RUST_CONFIG" \ -- -Dwarnings @@ -205,6 +218,13 @@ jobs: --no-deps \ --config "$RUST_CONFIG" \ -- -Dwarnings + cargo clippy --locked --package "$crate" \ + --no-default-features \ + --all-targets \ + --release \ + --no-deps \ + --config "$RUST_CONFIG" \ + -- -Dwarnings done codeql: @@ -284,6 +304,10 @@ jobs: run: | cd vectorset cargo clippy --locked --all-targets --no-deps --config "$RUST_CONFIG" -- -Dwarnings + - name: "vectorset: clippy --all-targets --release" + run: | + cd vectorset + cargo clippy --locked --all-targets --no-deps --config "$RUST_CONFIG" --release -- -Dwarnings vectorset-build: strategy: diff --git a/diskann-disk/src/build/builder/build.rs b/diskann-disk/src/build/builder/build.rs index d1bab6b22..fc4481b0c 100644 --- a/diskann-disk/src/build/builder/build.rs +++ b/diskann-disk/src/build/builder/build.rs @@ -28,7 +28,9 @@ use diskann_providers::{ }, }; use tokio::task::JoinSet; -use tracing::{debug, info}; +#[cfg(debug_assertions)] +use tracing::debug; +use tracing::info; use crate::{ build::builder::{ From a02e58d27c4f2b193dd7c12d9bd95c599aa95ace Mon Sep 17 00:00:00 2001 From: "Alex Razumov (from Dev Box)" Date: Thu, 29 Oct 2026 14:44:42 -0700 Subject: [PATCH 2/4] Fix RUST_CONFIG --- .github/workflows/ci.yml | 6 ++---- .github/workflows/disk-benchmarks-aa.yml | 9 +++++---- .github/workflows/disk-benchmarks.yml | 7 ++++--- .github/workflows/nightly.yml | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64c301704..29db4e529 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,10 +14,8 @@ concurrency: cancel-in-progress: true env: - # Pass additional arguments to cargo using `--config build.rustflags=["...", "..."]`. - # - # This ensures that we do not overwrite the parameters in `.cargo/config.toml` unnecessarily. - RUST_CONFIG: 'build.rustflags=["-Dwarnings"]' + # Append to target-specific rustflags without replacing `.cargo/config.toml` settings. + RUST_CONFIG: 'target."cfg(all())".rustflags=["-Dwarnings"]' RUST_BACKTRACE: 1 CARGO_TERM_COLOR: always diff --git a/.github/workflows/disk-benchmarks-aa.yml b/.github/workflows/disk-benchmarks-aa.yml index 6c780fcde..9200eb260 100644 --- a/.github/workflows/disk-benchmarks-aa.yml +++ b/.github/workflows/disk-benchmarks-aa.yml @@ -22,6 +22,7 @@ concurrency: cancel-in-progress: true env: + RUST_CONFIG: 'target."cfg(all())".rustflags=["-Dwarnings"]' RUST_BACKTRACE: 1 PERF_INPUTS: diskann-benchmark/perf_test_inputs @@ -85,26 +86,26 @@ jobs: # A/A: build once, run twice (identical code — only detecting environment noise) - name: Build benchmark binary working-directory: diskann_rust - run: cargo build -p diskann-benchmark --features disk-index --release + run: cargo build -p diskann-benchmark --features disk-index --release --config "$RUST_CONFIG" - name: Run baseline benchmark working-directory: diskann_rust run: | - cargo run -p diskann-benchmark --features disk-index --release -- \ + cargo run -p diskann-benchmark --features disk-index --release --config "$RUST_CONFIG" -- \ run --input-file ${{ env.PERF_INPUTS }}/${{ matrix.config }} \ --output-file target/tmp/${{ matrix.dataset }}_baseline.json - name: Run target benchmark working-directory: diskann_rust run: | - cargo run -p diskann-benchmark --features disk-index --release -- \ + cargo run -p diskann-benchmark --features disk-index --release --config "$RUST_CONFIG" -- \ run --input-file ${{ env.PERF_INPUTS }}/${{ matrix.config }} \ --output-file target/tmp/${{ matrix.dataset }}_target.json - name: Validate benchmark results working-directory: diskann_rust run: | - cargo run -p diskann-benchmark --features disk-index --release -- \ + cargo run -p diskann-benchmark --features disk-index --release --config "$RUST_CONFIG" -- \ check run \ --tolerances ${{ env.PERF_INPUTS }}/disk-index-tolerances.json \ --input-file ${{ env.PERF_INPUTS }}/${{ matrix.config }} \ diff --git a/.github/workflows/disk-benchmarks.yml b/.github/workflows/disk-benchmarks.yml index 9e2a0abad..c95dc91fd 100644 --- a/.github/workflows/disk-benchmarks.yml +++ b/.github/workflows/disk-benchmarks.yml @@ -40,6 +40,7 @@ concurrency: cancel-in-progress: true env: + RUST_CONFIG: 'target."cfg(all())".rustflags=["-Dwarnings"]' RUST_BACKTRACE: 1 PERF_INPUTS: diskann-benchmark/perf_test_inputs @@ -119,21 +120,21 @@ jobs: - name: Run baseline benchmark working-directory: baseline run: | - cargo run -p diskann-benchmark --features disk-index --release -- \ + cargo run -p diskann-benchmark --features disk-index --release --config "$RUST_CONFIG" -- \ run --input-file ../diskann_rust/${{ env.PERF_INPUTS }}/${{ matrix.config }} \ --output-file target/tmp/${{ matrix.dataset }}_baseline.json - name: Run current branch benchmark working-directory: diskann_rust run: | - cargo run -p diskann-benchmark --features disk-index --release -- \ + cargo run -p diskann-benchmark --features disk-index --release --config "$RUST_CONFIG" -- \ run --input-file ${{ env.PERF_INPUTS }}/${{ matrix.config }} \ --output-file target/tmp/${{ matrix.dataset }}_target.json - name: Validate benchmark results working-directory: diskann_rust run: | - cargo run -p diskann-benchmark --features disk-index --release -- \ + cargo run -p diskann-benchmark --features disk-index --release --config "$RUST_CONFIG" -- \ check run \ --tolerances ${{ env.PERF_INPUTS }}/disk-index-tolerances.json \ --input-file ${{ env.PERF_INPUTS }}/${{ matrix.config }} \ diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index d38d85a32..b75fc4808 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -14,7 +14,7 @@ concurrency: cancel-in-progress: true env: - RUST_CONFIG: 'build.rustflags=["-Dwarnings"]' + RUST_CONFIG: 'target."cfg(all())".rustflags=["-Dwarnings"]' RUST_BACKTRACE: 1 CARGO_TERM_COLOR: always From e624ff9c804406a876e0731d43596f6b48d15ae0 Mon Sep 17 00:00:00 2001 From: "Alex Razumov (from Dev Box)" Date: Thu, 29 Oct 2026 14:51:22 -0700 Subject: [PATCH 3/4] Add usages of --config "$RUST_CONFIG" --- .github/workflows/ci.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 29db4e529..02586243b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -247,7 +247,7 @@ jobs: - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 - name: Build workspace - run: cargo build --workspace --locked --profile test + run: cargo build --workspace --locked --profile test --config "$RUST_CONFIG" - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3 @@ -263,9 +263,9 @@ jobs: run: rustup show - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 - name: "workspace docs (including private items)" - run: cargo doc --locked --workspace --no-deps --all-features --document-private-items + run: cargo doc --locked --workspace --no-deps --all-features --document-private-items --config "$RUST_CONFIG" env: - RUSTDOCFLAGS: -D rustdoc::all + RUSTDOCFLAGS: -Dwarnings -D rustdoc::all vectorset-fmt: name: vectorset format check @@ -324,8 +324,8 @@ jobs: - name: "vectorset: build debug & release" run: | cd vectorset - cargo build --locked - cargo build --locked --release + cargo build --locked --config "$RUST_CONFIG" + cargo build --locked --release --config "$RUST_CONFIG" # Test micro-architecture detection and dispatching. # @@ -450,7 +450,7 @@ jobs: - name: "SDE Tests (AVX-512)" run: | set -euxo pipefail - cargo test --locked \ + cargo test --locked --config "$RUST_CONFIG" \ --package diskann-wide \ --package diskann-vector \ --package diskann-quantization \ @@ -560,7 +560,7 @@ jobs: - name: Generate miri code coverage env: - RUSTFLAGS: "--cfg=miri" + RUSTFLAGS: "-Dwarnings --cfg=miri" run: | cargo +nightly llvm-cov nextest --locked \ --package diskann-quantization \ @@ -621,11 +621,11 @@ jobs: - name: Generate baseline LLVM lines working-directory: baseline - run: cargo llvm-lines --package diskann-benchmark --all-features --release | head -100 | tee ../baseline-llvm-lines.txt + run: cargo llvm-lines --package diskann-benchmark --all-features --release --config "$RUST_CONFIG" | head -100 | tee ../baseline-llvm-lines.txt - name: Generate current LLVM lines working-directory: pr - run: cargo llvm-lines --package diskann-benchmark --all-features --release | head -100 | tee ../current-llvm-lines.txt + run: cargo llvm-lines --package diskann-benchmark --all-features --release --config "$RUST_CONFIG" | head -100 | tee ../current-llvm-lines.txt - name: Compare LLVM lines run: bash pr/.github/scripts/compare-llvm-lines.sh baseline-llvm-lines.txt current-llvm-lines.txt From 6c46591737e6881e0102eb874e01698ca1a23b95 Mon Sep 17 00:00:00 2001 From: "Alex Razumov (from Dev Box)" Date: Thu, 29 Oct 2026 14:53:23 -0700 Subject: [PATCH 4/4] Revert the fix --- diskann-disk/src/build/builder/build.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/diskann-disk/src/build/builder/build.rs b/diskann-disk/src/build/builder/build.rs index fc4481b0c..d1bab6b22 100644 --- a/diskann-disk/src/build/builder/build.rs +++ b/diskann-disk/src/build/builder/build.rs @@ -28,9 +28,7 @@ use diskann_providers::{ }, }; use tokio::task::JoinSet; -#[cfg(debug_assertions)] -use tracing::debug; -use tracing::info; +use tracing::{debug, info}; use crate::{ build::builder::{