Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ license = "MIT"
edition = "2021"

[workspace.lints.clippy]
allow_attributes = "warn"
undocumented_unsafe_blocks = "warn"

[workspace.dependencies]
Expand Down
1 change: 1 addition & 0 deletions diskann-benchmark-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ serde_json = { workspace = true }
thiserror.workspace = true

[lints.clippy]
allow_attributes = "warn"
undocumented_unsafe_blocks = "warn"
uninlined_format_args = "allow"
unwrap_used = "warn"
Expand Down
4 changes: 2 additions & 2 deletions diskann-benchmark-simd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ impl std::fmt::Display for SimilarityMeasure {
#[serde(rename_all = "kebab-case")]
enum Arch {
#[serde(rename = "x86-64-v4")]
#[allow(non_camel_case_types)]
#[expect(non_camel_case_types)]
X86_64_V4,
#[serde(rename = "x86-64-v3")]
#[allow(non_camel_case_types)]
#[expect(non_camel_case_types)]
X86_64_V3,
Neon,
Scalar,
Expand Down
1 change: 1 addition & 0 deletions diskann-benchmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ itertools.workspace = true
diskann-inmem = { workspace = true, optional = true }

[lints]
clippy.allow_attributes = "warn"
clippy.undocumented_unsafe_blocks = "warn"
clippy.uninlined_format_args = "allow"

Expand Down
2 changes: 1 addition & 1 deletion diskann-benchmark/src/exhaustive/algos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ where

// Lints: Using `ParallelIterator::collect`. It's the caller's responsibility to invoke
// this in a properly sized Rayon environment.
#[allow(clippy::disallowed_methods)]
#[expect(clippy::disallowed_methods)]
let times: Vec<Times> = output
.par_row_iter_mut()
.zip(queries.par_row_iter())
Expand Down
2 changes: 1 addition & 1 deletion diskann-benchmark/src/exhaustive/product.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ mod imp {
diskann_utils::views::Matrix::new(0, input.nrows(), quantizer.get_num_chunks());

// Compress the data.
#[allow(clippy::disallowed_methods)]
#[expect(clippy::disallowed_methods)]
data.par_row_iter_mut()
.zip(input.par_row_iter())
.try_for_each(|(d, i)| -> anyhow::Result<()> {
Expand Down
2 changes: 1 addition & 1 deletion diskann-benchmark/src/exhaustive/spherical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ mod imp {
let mut data = diskann_utils::views::Matrix::new(0, input.nrows(), bytes);

// Compress the data.
#[allow(clippy::disallowed_methods)]
#[expect(clippy::disallowed_methods)]
data.par_row_iter_mut()
.zip(input.par_row_iter())
.try_for_each(|(d, i)| -> anyhow::Result<()> {
Expand Down
4 changes: 2 additions & 2 deletions diskann-benchmark/src/inputs/multi_vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ use serde::{Deserialize, Serialize};
#[non_exhaustive]
pub(crate) enum BenchIsa {
#[serde(rename = "x86-64-v4")]
#[allow(non_camel_case_types)]
#[expect(non_camel_case_types)]
X86_64_V4,
#[serde(rename = "x86-64-v3")]
#[allow(non_camel_case_types)]
#[expect(non_camel_case_types)]
X86_64_V3,
Neon,
Scalar,
Expand Down
1 change: 1 addition & 0 deletions diskann-bftree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ default = []
experimental_diversity_search = ["diskann/experimental_diversity_search"]

[lints.clippy]
allow_attributes = "warn"
undocumented_unsafe_blocks = "warn"
unwrap_used = "warn"
expect_used = "warn"
Expand Down
3 changes: 1 addition & 2 deletions diskann-bftree/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,10 @@ impl TestCallCount {
}

#[cfg(not(test))]
#[allow(dead_code)]
pub(crate) struct TestCallCount {}

#[cfg(not(test))]
#[allow(dead_code)]
#[expect(dead_code)]
impl TestCallCount {
pub fn new() -> Self {
Self {}
Expand Down
2 changes: 1 addition & 1 deletion diskann-bftree/src/neighbors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{bftree_insert, TestCallCount};
pub struct NeighborProvider<I: BfTreeId> {
adjacency_list_index: BfTree,
dim: usize, // Max number of neighbors in a neighbor list + 1 for the neighbor count
#[allow(dead_code)]
#[cfg_attr(not(test), expect(dead_code))]
pub(crate) num_get_calls: TestCallCount,
_phantom: PhantomData<I>,
}
Expand Down
3 changes: 3 additions & 0 deletions diskann-disk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,6 @@ harness = false
# Some 'cfg's in the source tree will be flagged by `cargo clippy -j 2 --workspace --no-deps --all-targets -- -D warnings`
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage)'] }

[lints.clippy]
allow_attributes = "warn"
2 changes: 1 addition & 1 deletion diskann-disk/src/data_model/graph_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub struct GraphMetadata {
pub associated_data_length: usize,
}

#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
impl GraphMetadata {
/// Create a new `GraphMetadata` object.
pub fn new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use io_uring::IoUring;
pub struct IOContext {
// Kept alive so the file descriptor registered with the io_uring ring stays valid;
// the fd is used via `register_files`, so this field is never read directly.
#[allow(dead_code)]
#[expect(dead_code)]
pub file_handle: File,
pub ring: IoUring,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ mod file_io;
mod io_completion_port;
mod ssd_io_context;

#[allow(non_camel_case_types)]
#[expect(non_camel_case_types)]
pub type ULONG_PTR = usize;
#[allow(clippy::upper_case_acronyms)]
#[expect(clippy::upper_case_acronyms)]
pub type DWORD = u32;
#[allow(clippy::upper_case_acronyms)]
#[expect(clippy::upper_case_acronyms)]
pub type OVERLAPPED = windows_sys::Win32::System::IO::OVERLAPPED;
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,10 @@ mod tests {
}

#[test]
#[allow(clippy::read_zero_byte_vec)]
fn test_read_no_requests() {
let mut reader = LinuxAlignedFileReader::new(TEST_INDEX_PATH).unwrap();

let mut read_requests = Vec::<AlignedRead<u8, A512>>::new();
let result = reader.read(&mut read_requests);
let result = reader.read(&mut []);
assert!(result.is_ok());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,10 @@ mod tests {
}

#[test]
#[allow(clippy::read_zero_byte_vec)]
fn test_read_no_requests() {
let mut reader = WindowsAlignedFileReader::new(&test_index_path()).unwrap();

let mut read_requests = Vec::<AlignedRead<u8, A512>>::new();
let result = reader.read(&mut read_requests);
let result = reader.read(&mut []);
assert!(result.is_ok());
}

Expand Down
4 changes: 2 additions & 2 deletions diskann-disk/src/search/provider/disk_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,7 @@ where

/// Perform a raw search on the disk index.
/// This is a lower-level API that allows more control over the search parameters and output buffers.
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub(crate) fn search_internal(
&self,
query: &[Data::VectorDataType],
Expand All @@ -1376,7 +1376,7 @@ where
)
}

#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
fn search_internal_impl(
&self,
query: &[Data::VectorDataType],
Expand Down
4 changes: 2 additions & 2 deletions diskann-disk/src/storage/quant/pq/pq_generation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ mod pq_generation_tests {
2.1f32, 2.1f32, 2.2f32, 2.2f32, 2.2f32, 2.2f32, 2.2f32, 2.2f32, 2.2f32, 2.2f32, 100.0f32,
100.0f32, 100.0f32, 100.0f32, 100.0f32, 100.0f32, 100.0f32, 100.0f32,
];
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
fn create_context<'a, F: vfs::FileSystem>(
provider: &'a VirtualStorageProvider<F>,
dim: usize,
Expand Down Expand Up @@ -218,7 +218,7 @@ mod pq_generation_tests {
}
}

#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
fn create_new_compressor<'a, F: vfs::FileSystem>(
provider: &'a VirtualStorageProvider<F>,
dim: usize,
Expand Down
7 changes: 1 addition & 6 deletions diskann-disk/src/utils/instrumentation/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,9 @@ mod timer_tests {
use super::*;

#[test]
#[allow(clippy::if_same_then_else)]
fn test_new() {
let timer = Timer::new();
if cfg!(windows) {
assert!(timer.cycles.is_some());
} else if cfg!(target_os = "linux") {
assert!(timer.cycles.is_some());
} else if cfg!(target_os = "macos") {
if cfg!(any(windows, target_os = "linux", target_os = "macos")) {
assert!(timer.cycles.is_some());
} else {
panic!("No timer::test_new defined for current configuration");
Expand Down
8 changes: 4 additions & 4 deletions diskann-disk/src/utils/kmeans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use crate::error::{diskann_error, ErrorKind};
/// center to each data point, update centers, and also return inverted index.
/// If closest_centers == NULL, will allocate memory and return.
/// Similarly, if closest_docs == NULL, will allocate memory and return.
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
fn lloyds_iter(
data: &[f32],
num_points: usize,
Expand Down Expand Up @@ -116,7 +116,7 @@ fn lloyds_iter(
/// the results, else it will assume appropriate allocation as `closest_docs =
/// new vec<usize> [num_centers]`, and `closest_center = new size_t[num_points]`
/// Final centers are output in centers as row-major num_centers * dim.
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub fn run_lloyds(
data: &[f32],
num_points: usize,
Expand Down Expand Up @@ -232,7 +232,7 @@ fn select_random_pivots(
/// Returns an error if num_points > 8388608 (2^23).
/// If there are are fewer than num_center distinct points, pick all unique points as pivots,
/// and sample data randomly for the remaining pivots.
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub fn k_meanspp_selecting_pivots(
data: &[f32],
num_points: usize,
Expand Down Expand Up @@ -399,7 +399,7 @@ pub fn k_meanspp_selecting_pivots(
}

/// k-means algorithm interface
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub fn k_means_clustering(
data: &[f32],
num_points: usize,
Expand Down
4 changes: 2 additions & 2 deletions diskann-disk/src/utils/math_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pub fn compute_vecs_l2sq(
/// Pre-allocated dist_matrix should be num_points * num_centers and contain squared distances
/// Default value of k is 1
/// Ideally used only by compute_closest_centers
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub fn compute_closest_centers_in_block(
data: &[f32],
num_points: usize,
Expand Down Expand Up @@ -253,7 +253,7 @@ pub fn compute_closest_centers_in_block(
/// it will return inverted index for each center, assuming each of the inverted
/// indices is an empty vector. Additionally, if pts_norms_squared is not null,
/// then it will assume that point norms are pre-computed and use those values
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub fn compute_closest_centers(
data: &[f32],
num_points: usize,
Expand Down
8 changes: 4 additions & 4 deletions diskann-disk/src/utils/partition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::{
/// Block size for reading/processing large files and matrices in blocks
const BLOCK_SIZE_LARGE_FILE: u32 = 10_000;

#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub fn partition_with_ram_budget<T, StorageProvider, F>(
dataset_file: &str,
dim: usize,
Expand Down Expand Up @@ -69,7 +69,7 @@ where
Ok(num_parts)
}

#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
fn find_partition_size<T, StorageProvider, F>(
dataset_file: &str,
sampling_rate: f64,
Expand Down Expand Up @@ -234,7 +234,7 @@ where
partition_count
}

#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
fn shard_data_into_clusters_only_ids<T, StorageProvider>(
dataset_file: &str,
pivot_data: &[f32],
Expand Down Expand Up @@ -358,7 +358,7 @@ where
Ok(())
}

#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
fn estimate_cluster_sizes(
data_float: &[f32],
num_pts: usize,
Expand Down
3 changes: 3 additions & 0 deletions diskann-garnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ publish = false
[lib]
crate-type = ["cdylib"]

[lints.clippy]
allow_attributes = "warn"

[dependencies]
bytemuck.workspace = true
crossbeam = "0.8.4"
Expand Down
2 changes: 1 addition & 1 deletion diskann-garnet/src/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ unsafe impl AllocatorCore for AlignToEight {
unsafe fn deallocate(&self, ptr: NonNull<[u8]>, layout: std::alloc::Layout) {
// Lint: The given `layout` **should** be the same as that passed to `allocate`,
// which must have succeeded for the pointer to be valid in the first place.
#[allow(clippy::expect_used)]
#[expect(clippy::expect_used)]
let layout = layout.align_to(8).expect("invalid layout provided");
unsafe { GlobalAllocator.deallocate(ptr, layout) }
}
Expand Down
1 change: 1 addition & 0 deletions diskann-inmem/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ diskann-benchmark-core = { workspace = true, optional = true }
tokio = { workspace = true, optional = true }

[lints.clippy]
allow_attributes = "warn"
undocumented_unsafe_blocks = "warn"
unwrap_used = "warn"
expect_used = "warn"
Expand Down
1 change: 1 addition & 0 deletions diskann-label-filter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license.workspace = true
edition.workspace = true

[lints]
clippy.allow_attributes = "warn"
clippy.undocumented_unsafe_blocks = "warn"
clippy.uninlined_format_args = "allow"

Expand Down
1 change: 0 additions & 1 deletion diskann-label-filter/benches/benchmarks/parser_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ fn bench_parsers_comparison(c: &mut Criterion) {
group.finish();
}

#[allow(clippy::disallowed_methods)]
fn rng() -> rand::prelude::ThreadRng {
rand::rng()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ impl<IT> RoaringAttributeStore<IT>
where
IT: VectorId + IntoUsize,
{
#[allow(
dead_code,
reason = "This will be invoked by callers when they create a document provider."
#[cfg_attr(
not(test),
expect(
dead_code,
reason = "This will be invoked by callers when they create a document provider."
)
)]
pub fn new() -> Self {
Self {
Expand Down
Loading
Loading