Skip to content

Use #[expect] to detect unnecessary lint suppressions - #1409

Merged
Wei Wu (wuw92) merged 4 commits into
mainfrom
wuw92-lint-expectation-checks
Sep 18, 2026
Merged

Wei Wu (wuw92) merged 4 commits into
mainfrom
wuw92-lint-expectation-checks

Conversation

@wuw92

@wuw92 Wei Wu (wuw92) commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor
  • Does this PR have a descriptive title that could go in our release notes?
  • Does this PR add any new dependencies? No.
  • Does this PR modify any existing APIs?
  • Is the change to the API backwards compatible? See below.
  • Should this result in any changes to our documentation, either updating existing docs or adding new ones?

Reference Issues/PRs

Part of #1397.

What does this implement/fix? Briefly explain your changes.

The code uses #[allow(...)] attributes to suppress lint warnings. These attributes can become unnecessary after a code change, but Rust does not report that.

I replace the attributes with #[expect(...)]. This also suppresses the warning, but reports when the code no longer triggers the lint. And I enable clippy::allow_attributes across the workspace to flag local allow attributes and suggest expect instead.

I also remove some suppressions through small code changes:

  • Add missing error documentation and name the field-normalizer callback type.
  • Simplify assertions and test inputs instead of suppressing their lints.
  • Remove the deprecated CMDToolError::description() override and its test; legacy calls now use the standard trait default.

@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Sep 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.53%. Comparing base (aa57f53) to head (2d25641).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1409      +/-   ##
==========================================
- Coverage   91.54%   91.53%   -0.02%     
==========================================
  Files         526      526              
  Lines      103164   103148      -16     
==========================================
- Hits        94441    94413      -28     
- Misses       8723     8735      +12     
Flag Coverage Δ
miri 91.53% <100.00%> (-0.02%) ⬇️
unittests 91.27% <100.00%> (-0.02%) ⬇️

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

Files with missing lines Coverage Δ
diskann-benchmark-simd/src/lib.rs 87.42% <ø> (ø)
diskann-benchmark/src/exhaustive/product.rs 83.33% <ø> (ø)
diskann-benchmark/src/exhaustive/spherical.rs 83.33% <ø> (ø)
diskann-benchmark/src/inputs/multi_vector.rs 19.67% <ø> (ø)
diskann-bftree/src/lib.rs 59.09% <ø> (ø)
diskann-bftree/src/neighbors.rs 97.42% <ø> (ø)
diskann-disk/src/data_model/graph_metadata.rs 100.00% <ø> (ø)
...rch/provider/aligned_file_reader/platform/linux.rs 100.00% <ø> (ø)
...earch/provider/aligned_file_reader/reader/linux.rs 83.95% <100.00%> (-0.09%) ⬇️
diskann-disk/src/search/provider/disk_provider.rs 95.65% <ø> (ø)
... and 71 more

... and 6 files with indirect coverage changes

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

Use lint expectations for necessary local exceptions and remove obsolete suppressions. Preserve existing test policies and narrow allowances for generated bindings and shared benchmark code.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@wuw92
Wei Wu (wuw92) force-pushed the wuw92-lint-expectation-checks branch from 6fe5087 to 1a703f2 Compare September 17, 2026 06:07
@wuw92 Wei Wu (wuw92) changed the title Enable clippy::allow_attributes and migrate local exceptions Use #[expect] to detect unnecessary lint suppressions Sep 17, 2026
@wuw92
Wei Wu (wuw92) marked this pull request as ready for review September 17, 2026 06:29
@wuw92
Wei Wu (wuw92) requested review from a team and a lite review from Copilot September 17, 2026 06:29

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.

🟡 Changes recommended

Three critical issues remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Updates Rust lint handling across the DiskANN workspace by replacing unnecessary #[allow] suppressions with #[expect] and cleaning up related code.

Changes:

  • Enables clippy::allow_attributes across workspace crates.
  • Converts intentional suppressions and removes obsolete ones.
  • Simplifies tests, adds documentation, and removes deprecated error behavior.
File summaries
File Change
diskann/src/utils/utils.rs Simplifies compile-time assertion.
diskann/src/utils/mod.rs Tracks module-inception suppression.
diskann/src/provider.rs Tracks async-function suppression.
diskann/src/graph/test/cases/inline.rs Tracks argument-count suppression.
diskann/src/graph/search/range_search.rs Removes obsolete suppression.
diskann/src/graph/index.rs Removes obsolete suppression.
diskann/src/graph/adjacencylist.rs Replaces manual debug panic with debug_assert!.
diskann/Cargo.toml Enables allow-attribute linting.
diskann-wide/src/lib.rs Updates alias macro suppressions.
diskann-wide/src/arch/x86_64/v4/mod.rs Updates Miri alias suppression.
diskann-wide/src/arch/x86_64/v3/u8x64_.rs Tracks naming suppression.
diskann-wide/src/arch/x86_64/v3/u64x8_.rs Tracks naming suppression.
diskann-wide/src/arch/x86_64/v3/u32x16_.rs Tracks naming suppression.
diskann-wide/src/arch/x86_64/v3/masks.rs Tracks mask naming suppressions.
diskann-wide/src/arch/x86_64/v3/i8x64_.rs Tracks naming suppression.
diskann-wide/src/arch/x86_64/v3/i32x16_.rs Tracks naming suppression.
diskann-wide/src/arch/x86_64/v3/i16x32_.rs Tracks naming suppression.
diskann-wide/src/arch/x86_64/v3/f32x16_.rs Tracks naming suppression.
diskann-wide/src/arch/x86_64/macros.rs Tracks generated register naming suppression.
diskann-wide/src/arch/mod.rs Tracks associated-type naming suppression.
diskann-wide/src/arch/aarch64/masks.rs Tracks generated mask naming suppression.
diskann-wide/src/arch/aarch64/macros.rs Tracks generated register naming suppression.
diskann-wide/src/arch/aarch64/double.rs Tracks generated alias naming suppression.
diskann-wide/Cargo.toml Enables allow-attribute linting.
diskann-vector/src/distance/test/mod.rs Removes obsolete panic suppressions.
diskann-vector/src/distance/simd.rs Tracks panic and argument-count suppressions.
diskann-vector/src/distance/implementations.rs Tracks panic and argument-count suppressions.
diskann-vector/src/conversion.rs Tracks panic suppression.
diskann-vector/Cargo.toml Enables allow-attribute linting.
diskann-vector/benches/utils/record.rs Tracks required benchmark suppression.
diskann-utils/src/views.rs Tracks unused test-field suppression.
diskann-tools/src/utils/search_index_utils.rs Removes obsolete argument-count suppression.
diskann-tools/src/utils/random_data_generator.rs Removes obsolete panic suppressions.
diskann-tools/src/utils/ground_truth.rs Updates argument-count suppressions.
diskann-tools/src/utils/compute_bitmap.rs Tracks dead-code and method suppressions.
diskann-tools/src/utils/cmd_tool_error.rs Removes deprecated error method and test.
diskann-tools/src/bin/compute_streaming_groundtruth.rs Adds a reasoned thread-pool suppression.
diskann-tools/Cargo.toml Enables allow-attribute linting.
diskann-quantization/src/spherical/quantizer.rs Updates unwrap and expect suppressions.
diskann-quantization/src/product/tables/transposed/table.rs Tracks expected panics.
diskann-quantization/src/multi_vector/matrix.rs Tracks expected panic.
diskann-quantization/src/multi_vector/distance/isa.rs Tracks enum naming suppression.
diskann-quantization/src/multi_vector/block_transposed.rs Updates panic, safety, and expect suppressions.
diskann-quantization/src/minmax/quantizer.rs Tracks unwrap suppressions.
diskann-quantization/src/matrix_kernels/bounds.rs Tracks comparison API imports.
diskann-quantization/src/lib.rs Tracks generated FlatBuffers suppressions.
diskann-quantization/src/distances.rs Tracks panic suppression.
diskann-quantization/src/bits/slice.rs Tracks panic suppression.
diskann-quantization/src/bits/distances.rs Tracks SIMD alias naming suppressions.
diskann-quantization/src/alloc/aligned.rs Tracks expected layout failure.
diskann-quantization/src/algorithms/transforms/random_rotation.rs Tracks unwrap suppression.
diskann-quantization/src/algorithms/transforms/padding_hadamard.rs Tracks transform unwrap suppressions.
diskann-quantization/src/algorithms/transforms/double_hadamard.rs Tracks transform unwrap suppressions.
diskann-quantization/Cargo.toml Enables allow and panic-related linting.
diskann-providers/src/utils/vector_data_iterator.rs Tracks iterator lint suppression.
diskann-providers/src/utils/rayon_util.rs Tracks thread-pool suppressions.
diskann-providers/src/utils/random.rs Removes obsolete random-method suppression.
diskann-providers/src/utils/file_util.rs Removes obsolete complexity suppression.
diskann-providers/src/storage/virtual_storage_provider.rs Tracks filesystem-method suppressions.
diskann-providers/src/model/pq/pq_construction.rs Removes obsolete argument-count suppression.
diskann-providers/src/model/pq/generate_pivot_arguments.rs Adds error and field documentation.
diskann-providers/src/model/pq/fixed_chunk_pq_table.rs Simplifies test expressions.
diskann-providers/src/model/pq/distance/multi.rs Tracks test argument-count suppressions.
diskann-providers/src/model/graph/provider/async_/simple_neighbor_provider.rs Tracks lock unwrap suppressions.
diskann-providers/src/model/graph/provider/async_/distances.rs Tracks conversion unwrap suppressions.
diskann-providers/src/model/graph/provider/async_/common.rs Tracks mutable-reference suppression.
diskann-providers/src/model/configuration/index_configuration.rs Removes obsolete argument-count suppression.
diskann-providers/src/index/wrapped_async.rs Tracks runtime expect suppressions.
diskann-providers/src/common/minmax_repr.rs Tracks unwrap suppressions.
diskann-providers/src/common/ignore_lock_poison.rs Tracks lock expect suppression.
diskann-providers/Cargo.toml Enables allow-attribute linting.
diskann-linalg/src/reference.rs Tracks argument-count suppressions.
diskann-linalg/src/lib.rs Tracks public matrix multiplication suppression.
diskann-linalg/src/faer.rs Tracks argument-count suppression.
diskann-linalg/src/alternates/mkl.rs Tracks argument-count suppression.
diskann-linalg/Cargo.toml Enables allow-attribute linting.
diskann-label-filter/src/traits/key_codec.rs Removes approximate-constant suppression.
diskann-label-filter/src/kv_index/generic_index.rs Names the normalizer callback type.
diskann-label-filter/src/encoded_attribute_provider/roaring_attribute_store.rs Makes dead-code expectation test-aware.
diskann-label-filter/Cargo.toml Enables allow-attribute linting.
diskann-label-filter/benches/benchmarks/parser_bench.rs Removes obsolete RNG suppression.
diskann-inmem/Cargo.toml Enables allow-attribute linting.
diskann-garnet/src/alloc.rs Tracks layout expect suppression.
diskann-garnet/Cargo.toml Enables allow-attribute linting.
diskann-disk/src/utils/partition.rs Tracks argument-count suppressions.
diskann-disk/src/utils/math_util.rs Tracks argument-count suppressions.
diskann-disk/src/utils/kmeans.rs Tracks argument-count suppressions.
diskann-disk/src/utils/instrumentation/timer.rs Simplifies platform assertions.
diskann-disk/src/storage/quant/pq/pq_generation.rs Tracks test argument-count suppression.
diskann-disk/src/search/provider/disk_provider.rs Tracks search argument-count suppressions.
diskann-disk/src/search/provider/aligned_file_reader/reader/windows.rs Simplifies empty-read test input.
diskann-disk/src/search/provider/aligned_file_reader/reader/linux.rs Simplifies empty-read test input.
diskann-disk/src/search/provider/aligned_file_reader/platform/windows/mod.rs Tracks platform naming suppressions.
diskann-disk/src/search/provider/aligned_file_reader/platform/linux.rs Tracks dead-code suppression.
diskann-disk/src/data_model/graph_metadata.rs Tracks constructor argument-count suppression.
diskann-disk/Cargo.toml Enables allow-attribute linting.
diskann-bftree/src/neighbors.rs Makes test instrumentation expectation test-aware.
diskann-bftree/src/lib.rs Tracks production test-counter dead code.
diskann-bftree/Cargo.toml Enables allow-attribute linting.
diskann-benchmark/src/inputs/multi_vector.rs Tracks ISA naming suppressions.
diskann-benchmark/src/exhaustive/spherical.rs Tracks Rayon suppression.
diskann-benchmark/src/exhaustive/product.rs Tracks Rayon suppression.
diskann-benchmark/src/exhaustive/algos.rs Tracks Rayon suppression.
diskann-benchmark/Cargo.toml Enables allow-attribute linting.
diskann-benchmark-simd/src/lib.rs Tracks ISA naming suppressions.
diskann-benchmark-runner/Cargo.toml Enables allow-attribute linting.
Cargo.toml Adds workspace-level allow-attribute linting.
Review details
  • Files reviewed: 107/107 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread diskann-label-filter/src/kv_index/generic_index.rs Outdated
Comment thread diskann-quantization/src/matrix_kernels/bounds.rs
Comment thread diskann-wide/src/lib.rs Outdated

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.

Thanks Wei! One small ask on the alias! macro in diskann-wide. Otherwise looks great.

Comment thread diskann-wide/src/lib.rs Outdated
Wei Wu (wuw92) and others added 3 commits September 18, 2026 09:26
Fix formatting of constants and update FieldNormalizer type.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Keep allow for caller-selected alias names and explain the local allow_attributes exception.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@wuw92
Wei Wu (wuw92) merged commit 8f11bd4 into main Sep 18, 2026
32 checks passed
@wuw92
Wei Wu (wuw92) deleted the wuw92-lint-expectation-checks branch September 18, 2026 04:11
Mark Hildebrand (hildebrandmw) added a commit that referenced this pull request Sep 18, 2026
#1409 required the use of `expect` for allowances rather than `allow`,
helping us clean up allowances that no-longer fire. However, this
interacted poorly with the `diskann_wide::alias!` macro, which can have
both proper camel-case and non-camel-case types (and thus needs
`allow`). The final version of #1409 put an `expect` allowance on
`allow(non_camel_case_type)`, but this breaks user code outside of
DiskANN that may be using different lints.

This PR places an allowance on the macro itself to (1) keep non-DiskANN
uses compiling and (2) keep DiskANN uses compiling with the new lints.

Finally, the macro-level allowance does not apply within the
`diskann-wide` crate itself. I made `diskann-wide` an exception to the
`allow_attributes` lint for this reason.
Mark Hildebrand (hildebrandmw) added a commit that referenced this pull request Oct 5, 2026
# DiskANN v0.60.0

## Major Changes

### `diskann-utils`: Matrix API changes

There have been significant changes to the matrix APIs in
`diskann-utils`. The previous contents of `diskann_utils::views` have
been moved to `diskann_utils::views::rowmajor`. The following type
changes have been made

| v0.59 | v0.60 | Remarks |
|-|-|-|
| `views::Matrix<T>` | `views::rowmajor::Owned<T>` | Size changed from
32 bytes to 24 bytes |
| `views::MatrixView<'a, T>` | `views::rowmajor::Ref<'a, T>` | Size
changed from 32 bytes to 24 bytes |
| `views::MatrixViewMut<'a, T>` | `views::rowmajor::Mut<'a, T>` | Size
changed from 32 bytes to 24 bytes |
| `MatrixBase` inherent methods | `rowmajor::Matrix` and
`rowmajor::MatrixMut` trait methods | |

The `rowmajor::Matrix` and `rowmajor::MatrixMut` trait methods need to
be imported to access most matrix functionality. In addition, the
following methods have been renamed and changed:

| v0.59 | v0.60 | Remark |
|-|-|-|
| `row_iter` | `rows` | No longer panics when `ncols == 0` |
| `row_iter_mut` | `rows_mut` | No longer panics when `ncols == 0` |
| `par_row_iter` | `par_rows` | No longer panics when `ncols == 0` |
| `par_row_iter_mut` | `par_rows_mut` | |
| `get_row_unchecked` | `row_unchecked` | |
| `get_row_unchecked_mut` | `row_unchecked_mut` | |
| `as_mut_view` | `as_view_mut` | | 
| `try_from` constructors | `try_from_data` | |

In addition, 

* The `Index` and `IndexMut` implementations have been removed. Use
`Matrix::element` and `Matrix::element_mut` instead.
* The `Init` and `Generator` style constructors for `Matrix::new` have
been removed. Instead, `rowmajor::Owned::from_fn` and
`rowmajor::Owned::from_element` can be used instead. The former's
closure has been changed to take an argument `rowmajor::RowCol`
indicated the row and column being initialized. Both of these
constructors take now take the initializer as the last argument.
* Matrix constructors validate against integer overflow and `isize::MAX`
allocations via a `rowmajor::Layout<T>` layout. Constructors panic if
these validations fail. `try_*` variations of these constructors which
return `rowmajor::LayoutError` instead.

### `diskann-utils`: Strided API changes

* Structs `StridedBase`, `StridedView`, and `MutStridedView` were
collapsed into a single, immutable `Strided<'a, T>`.
* `strided::linear_length` was removed, use
`strided::Layout::linear_length` instead.
* `strided::TryFromErrorLight` was removed.
* `strided::TryFromError` changed from a struct to an enum, and
`into_inner`/`as_static` were removed.

### `diskann`

`InsertStrategy` is no longer a `SearchStrategy` subtrait.
Implementations must now provide
```rust
type SearchAccessor;
type SearchAccessorError;

fn insert_search_accessor(...) -> Result<Self::SearchAccessor, Self::SearchAccessorError>;
```
Previously, `insert_search_accessor` had a provided implementation
forwarding to `SearchStrategy::search_accessor`. That default is now
gone. This change was done to decouple insert element types from search
element types.

### `diskann-disk`

The publicly re-exported types below were removed in favor of standard
buffered I/O:
```
diskann_disk::storage::CachedReader
diskann_disk::storage::CachedWriter
```
Consumers should migrate to `std::io::BufReader`/`BufWriter` and the
relevant storage-provider reader/writer. `READ_WRITE_BLOCK_SIZE` also
changed from `u64` to `usize`.

### `diskann-quantization`

These public traits now require `Debug`:
```
spherical::iface::Quantizer
spherical::iface::DynQueryComputer
spherical::iface::DynDistanceComputer
```

### `diskann-inmem` (experimental)

The old `layers` abstraction was removed and replaced by the
`Representation`/`Store`/`Slots` architecture. And support for a
spherically quantized backed was added.

# Full Change Log
* [diskann-inmem] Prepare code for quantization and beyond by
@hildebrandmw in #1352
* Add Neon inner product U8xU1, U8xU2 and U8xU4 kernels by @pfoxARM in
#1372
* [CI] Check all workspace features and private docs by @wuw92 in
#1400
* [CI] Check Rust license headers by @wuw92 in
#1401
* [disk] Replace custom cached I/O with standard buffered readers and
writers by @wuw92 in #1396
* [dikkann_wide] Integer SIMDMinMax by @suri-kumkaran in
#1407
* Add Neon Squared L2 kernels for USlice2 and USlice4 by @pfoxARM in
#1398
* Bump the github-actions group with 3 updates by @dependabot[bot] in
#1406
* [CI] Check workspace direct dependency versions by @wuw92 in
#1410
* Train fresh disk-search PQ codebooks for each index build by @xwj-ox
in #1299
* [diskann-quantization] Make most things in
`diskann-quantization/spherical/iface.rs` debuggable by @hildebrandmw in
#1414
* [diskann] Make `InsertStrategy` independent of `SearchStrategy` by
@hildebrandmw in #1393
* Use #[expect] to detect unnecessary lint suppressions by @wuw92 in
#1409
* [diskann-garnet] Store attributes during insert, not after by
@metajack in #1412
* [diskann-wide] Fix `alias!` by @hildebrandmw in
#1417
* [diskann-utils] Simplify `StridedView`. by @hildebrandmw in
#1376
* [diskann-wide] More Neon Zip/Unzip impls by @hildebrandmw in
#1405
* [diskann-garnet] Deserialize max id for quantization on load by
@metajack in #1419
* More ergonomic `spherical::iface::Quantizer` constructors by
@hildebrandmw in #1418
* [diskann-bftree] Clamp number of concurrency test parallel workers by
@hildebrandmw in #1433
* Tweak behavior of adaptive L by @magdalendobson in
#1354
* Bump the github-actions group with 2 updates by @dependabot[bot] in
#1436
* Reform Range Search by @magdalendobson in
#1337
* PiPNN 2/6: add numerical kernels by @SeliMeli in
#1287
* Matrix overhaul 1 of N - Data Accessors by @hildebrandmw in
#1415
* Add `assert_contains!` helper by @hildebrandmw in
#1421
* Matrix overhaul 2 of N - `Matrix` invariants by @hildebrandmw in
#1420
* [CI] Run SDE tests for diskann with all features by @SeliMeli in
#1440
* [diskann-wide] Add Neon `vabdq_u8` and `vabdq_s8`. by @hildebrandmw in
#1437
* [diskann-inmem] Add support for spherical quantization by
@hildebrandmw in #1432
* [benchmark-runner] Bump edition to 2024 by @hildebrandmw in
#1444
* [diskann-wide] Add byte-vector reinterpretations for u32x8 and u64x8
by @partychen in #1445
* Propagate invalid matrix layout errors in production paths by @arrayka
in #1453
* Add sparse vector distance kernels (f32/f16 L2, inner product, cosine)
by @mana-agarwal in #1434
* Bump the github-actions group with 3 updates by @dependabot[bot] in
#1454
* [diskann-utils] Matrix Update 3 of N (constructors) by @hildebrandmw
in #1451
* [diskann-utils] Matrix Update 4 of 4 by @hildebrandmw in
#1457

## New Contributors
* @mana-agarwal made their first contribution in
#1434

**Full Changelog**:
v0.59.0...v0.60.0
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