Make clippy happy

This commit is contained in:
Clément Renault
2025-08-12 16:20:32 +02:00
committed by Louis Dureuil
parent fb68f1241c
commit 4645813ea8
3 changed files with 46 additions and 59 deletions

View File

@ -5,7 +5,6 @@ use std::sync::atomic::{AtomicU32, AtomicUsize, Ordering};
use std::sync::{Arc, RwLock};
use std::time::{Duration, Instant};
use enum_iterator::Sequence;
use indexmap::IndexMap;
use itertools::Itertools;
use serde::Serialize;

View File

@ -485,7 +485,7 @@ where
// If an embedder wasn't used in the typedchunk but must be binary quantized
// we should insert it in `dimension`
let index_version = self.index.get_version(&self.wtxn)?.unwrap();
let index_version = self.index.get_version(self.wtxn)?.unwrap();
for (name, action) in settings_diff.embedding_config_updates.iter() {
if action.is_being_quantized && !dimension.contains_key(name.as_str()) {
let index = self.index.embedding_configs().embedder_id(self.wtxn, name)?.ok_or(

View File

@ -129,8 +129,7 @@ impl VectorStore {
self._arroy_items_in_store(rtxn, self.arroy_angular_db(), store_id, with_items)
.map_err(Into::into)
}
} else {
if self.quantized {
} else if self.quantized {
self._items_in_store(rtxn, self.quantized_db(), store_id, with_items)
.map_err(Into::into)
} else {
@ -138,7 +137,6 @@ impl VectorStore {
.map_err(Into::into)
}
}
}
fn _arroy_items_in_store<D: arroy::Distance, F, O>(
&self,
@ -193,8 +191,7 @@ impl VectorStore {
.transpose()?
.map(|reader| reader.dimensions()))
}
} else {
if self.quantized {
} else if self.quantized {
Ok(self
.readers(rtxn, self.quantized_db())
.next()
@ -208,7 +205,6 @@ impl VectorStore {
.map(|reader| reader.dimensions()))
}
}
}
pub fn convert_from_arroy(&self, wtxn: &mut RwTxn, progress: Progress) -> crate::Result<()> {
if self.quantized {
@ -550,8 +546,7 @@ impl VectorStore {
}
writer.contains_item(rtxn, item)?
}
} else {
if self.quantized {
} else if self.quantized {
let writer = hannoy::Writer::new(self.quantized_db(), index, dimension);
if writer.is_empty(rtxn)? {
continue;
@ -563,7 +558,6 @@ impl VectorStore {
continue;
}
writer.contains_item(rtxn, item)?
}
};
if contains {
return Ok(contains);
@ -587,15 +581,13 @@ impl VectorStore {
self._arroy_nns_by_item(rtxn, self.arroy_angular_db(), item, limit, filter)
.map_err(Into::into)
}
} else {
if self.quantized {
} else if self.quantized {
self._nns_by_item(rtxn, self.quantized_db(), item, limit, filter)
.map_err(Into::into)
} else {
self._nns_by_item(rtxn, self.angular_db(), item, limit, filter).map_err(Into::into)
}
}
}
fn _arroy_nns_by_item<D: arroy::Distance>(
&self,
@ -669,8 +661,7 @@ impl VectorStore {
self._arroy_nns_by_vector(rtxn, self.arroy_angular_db(), vector, limit, filter)
.map_err(Into::into)
}
} else {
if self.quantized {
} else if self.quantized {
self._nns_by_vector(rtxn, self.quantized_db(), vector, limit, filter)
.map_err(Into::into)
} else {
@ -678,7 +669,6 @@ impl VectorStore {
.map_err(Into::into)
}
}
}
fn _arroy_nns_by_vector<D: arroy::Distance>(
&self,
@ -754,8 +744,7 @@ impl VectorStore {
}
}
}
} else {
if self.quantized {
} else if self.quantized {
for reader in self.readers(rtxn, self.quantized_db()) {
if let Some(vec) = reader?.item_vector(rtxn, item_id)? {
vectors.push(vec);
@ -768,7 +757,6 @@ impl VectorStore {
}
}
}
}
Ok(vectors)
}