From 1e1e6be35c6aaef1164102993c49a585a73582e1 Mon Sep 17 00:00:00 2001 From: Sanket Kedia Date: Sun, 10 Nov 2024 22:56:06 -0800 Subject: [PATCH] Linter --- rust/blockstore/src/arrow/blockfile.rs | 2 +- rust/blockstore/src/memory/storage.rs | 4 ++-- rust/blockstore/src/types/reader.rs | 2 +- rust/index/src/hnsw.rs | 1 - rust/index/src/lib.rs | 1 + rust/index/src/spann/types.rs | 4 ++-- rust/index/src/types.rs | 5 ++--- rust/worker/src/segment/distributed_hnsw_segment.rs | 7 +++---- rust/worker/src/segment/spann_segment.rs | 10 ++++++---- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/rust/blockstore/src/arrow/blockfile.rs b/rust/blockstore/src/arrow/blockfile.rs index 714dbc3888fb..c60a1e5eb7de 100644 --- a/rust/blockstore/src/arrow/blockfile.rs +++ b/rust/blockstore/src/arrow/blockfile.rs @@ -699,7 +699,7 @@ impl<'me, K: ArrowReadableKey<'me> + Into, V: ArrowReadableValue<'me result.extend(block.get_all_data()); } - return result; + result } } diff --git a/rust/blockstore/src/memory/storage.rs b/rust/blockstore/src/memory/storage.rs index 29e7fb251fdf..829740e2dea9 100644 --- a/rust/blockstore/src/memory/storage.rs +++ b/rust/blockstore/src/memory/storage.rs @@ -586,11 +586,11 @@ impl Writeable for &DataRecord<'_> { } impl Writeable for &SpannPostingList<'_> { - fn write_to_storage(prefix: &str, key: KeyWrapper, value: Self, storage: &StorageBuilder) { + fn write_to_storage(_: &str, _: KeyWrapper, _: Self, _: &StorageBuilder) { todo!() } - fn remove_from_storage(prefix: &str, key: KeyWrapper, storage: &StorageBuilder) { + fn remove_from_storage(_: &str, _: KeyWrapper, _: &StorageBuilder) { todo!() } } diff --git a/rust/blockstore/src/types/reader.rs b/rust/blockstore/src/types/reader.rs index 926bcad4b9df..7b8e70c2bf0f 100644 --- a/rust/blockstore/src/types/reader.rs +++ b/rust/blockstore/src/types/reader.rs @@ -134,7 +134,7 @@ impl< pub async fn get_all_data(&'referred_data self) -> Vec<(&'referred_data str, K, V)> { match self { - BlockfileReader::MemoryBlockfileReader(reader) => todo!(), + BlockfileReader::MemoryBlockfileReader(_) => todo!(), BlockfileReader::ArrowBlockfileReader(reader) => reader.get_all_data().await, } } diff --git a/rust/index/src/hnsw.rs b/rust/index/src/hnsw.rs index 875a444706bf..cb92eb754308 100644 --- a/rust/index/src/hnsw.rs +++ b/rust/index/src/hnsw.rs @@ -1,6 +1,5 @@ use super::{Index, IndexConfig, IndexUuid, PersistentIndex}; use chroma_error::{ChromaError, ErrorCodes}; -use chroma_types::MetadataValueConversionError; use std::ffi::CString; use std::ffi::{c_char, c_int}; use std::path::Path; diff --git a/rust/index/src/lib.rs b/rust/index/src/lib.rs index ac9d9c585cd0..5c9b21e95a07 100644 --- a/rust/index/src/lib.rs +++ b/rust/index/src/lib.rs @@ -13,6 +13,7 @@ use chroma_cache::new_non_persistent_cache_for_test; use chroma_storage::test_storage; pub use hnsw::*; use hnsw_provider::HnswIndexProvider; +#[allow(unused_imports)] pub use spann::*; use tempfile::tempdir; pub use types::*; diff --git a/rust/index/src/spann/types.rs b/rust/index/src/spann/types.rs index f884ffb30cf5..c8ab2f76d3f3 100644 --- a/rust/index/src/spann/types.rs +++ b/rust/index/src/spann/types.rs @@ -1,6 +1,5 @@ use std::collections::HashMap; -use arrow::error; use chroma_blockstore::{provider::BlockfileProvider, BlockfileWriter, BlockfileWriterOptions}; use chroma_distance::DistanceFunction; use chroma_error::{ChromaError, ErrorCodes}; @@ -14,6 +13,7 @@ use crate::{ }; // TODO(Sanket): Add locking structures as necessary. +#[allow(dead_code)] pub struct SpannIndexWriter { // HNSW index and its provider for centroid search. hnsw_index: HnswIndexRef, @@ -125,7 +125,7 @@ impl SpannIndexWriter { ) -> Result { let mut bf_options = BlockfileWriterOptions::new(); bf_options = bf_options.unordered_mutations(); - bf_options = bf_options.fork(blockfile_id.clone()); + bf_options = bf_options.fork(*blockfile_id); match blockfile_provider .write::>(bf_options) .await diff --git a/rust/index/src/types.rs b/rust/index/src/types.rs index e906ef84376e..bcccaed2744f 100644 --- a/rust/index/src/types.rs +++ b/rust/index/src/types.rs @@ -1,6 +1,5 @@ -use chroma_distance::{DistanceFunction, DistanceFunctionError}; -use chroma_error::{ChromaError, ErrorCodes}; -use thiserror::Error; +use chroma_distance::DistanceFunction; +use chroma_error::ChromaError; use uuid::Uuid; #[derive(Clone, Debug)] diff --git a/rust/worker/src/segment/distributed_hnsw_segment.rs b/rust/worker/src/segment/distributed_hnsw_segment.rs index 77ef086d69b9..e22807897f94 100644 --- a/rust/worker/src/segment/distributed_hnsw_segment.rs +++ b/rust/worker/src/segment/distributed_hnsw_segment.rs @@ -4,16 +4,15 @@ use super::record_segment::ApplyMaterializedLogError; use super::utils::hnsw_params_from_segment; use super::{SegmentFlusher, SegmentWriter}; use async_trait::async_trait; -use chroma_distance::{DistanceFunction, DistanceFunctionError}; +use chroma_distance::DistanceFunctionError; use chroma_error::{ChromaError, ErrorCodes}; use chroma_index::hnsw_provider::{ HnswIndexProvider, HnswIndexProviderCreateError, HnswIndexProviderForkError, HnswIndexProviderOpenError, HnswIndexRef, }; -use chroma_index::{HnswIndexConfig, Index, IndexConfig, IndexUuid}; -use chroma_index::{DEFAULT_HNSW_EF_CONSTRUCTION, DEFAULT_HNSW_EF_SEARCH, DEFAULT_HNSW_M}; +use chroma_index::{Index, IndexUuid}; use chroma_types::SegmentUuid; -use chroma_types::{get_metadata_value_as, MaterializedLogOperation, MetadataValue, Segment}; +use chroma_types::{MaterializedLogOperation, Segment}; use std::collections::HashMap; use std::fmt::Debug; use thiserror::Error; diff --git a/rust/worker/src/segment/spann_segment.rs b/rust/worker/src/segment/spann_segment.rs index 414dcfbf0b23..54c42385de53 100644 --- a/rust/worker/src/segment/spann_segment.rs +++ b/rust/worker/src/segment/spann_segment.rs @@ -1,6 +1,3 @@ -use std::collections::HashMap; - -use arrow::error; use chroma_blockstore::provider::BlockfileProvider; use chroma_error::{ChromaError, ErrorCodes}; use chroma_index::{hnsw_provider::HnswIndexProvider, spann::types::SpannIndexWriter, IndexUuid}; @@ -10,10 +7,14 @@ use uuid::Uuid; use super::utils::{distance_function_from_segment, hnsw_params_from_segment}; +#[allow(dead_code)] const HNSW_PATH: &str = "hnsw_path"; +#[allow(dead_code)] const VERSION_MAP_PATH: &str = "version_map_path"; +#[allow(dead_code)] const POSTING_LIST_PATH: &str = "posting_list_path"; +#[allow(dead_code)] pub(crate) struct SpannSegmentWriter { index: SpannIndexWriter, id: SegmentUuid, @@ -52,6 +53,7 @@ impl ChromaError for SpannSegmentWriterError { } impl SpannSegmentWriter { + #[allow(dead_code)] pub async fn from_segment( segment: &Segment, blockfile_provider: &BlockfileProvider, @@ -63,7 +65,7 @@ impl SpannSegmentWriter { } let distance_function = match distance_function_from_segment(segment) { Ok(distance_function) => distance_function, - Err(e) => { + Err(_) => { return Err(SpannSegmentWriterError::DistanceFunctionNotFound); } };