increase rust version from 1.85 to 1.89

This commit is contained in:
Tamo
2025-09-16 17:21:33 +02:00
parent 06b3ca9eb5
commit 26d9070aa7
36 changed files with 63 additions and 73 deletions

View File

@ -621,7 +621,7 @@ impl From<HeedError> for Error {
// TODO use the encoding
HeedError::Encoding(_) => InternalError(Serialization(Encoding { db_name: None })),
HeedError::Decoding(_) => InternalError(Serialization(Decoding { db_name: None })),
HeedError::EnvAlreadyOpened { .. } => UserError(EnvAlreadyOpened),
HeedError::EnvAlreadyOpened => UserError(EnvAlreadyOpened),
}
}
}

View File

@ -19,14 +19,14 @@ impl RoaringBitmapLenCodec {
if cookie == SERIAL_COOKIE_NO_RUNCONTAINER {
(bytes.read_u32::<LittleEndian>()? as usize, true)
} else if (cookie as u16) == SERIAL_COOKIE {
return Err(io::Error::new(io::ErrorKind::Other, "run containers are unsupported"));
return Err(io::Error::other("run containers are unsupported"));
} else {
return Err(io::Error::new(io::ErrorKind::Other, "unknown cookie value"));
return Err(io::Error::other("unknown cookie value"));
}
};
if size > u16::MAX as usize + 1 {
return Err(io::Error::new(io::ErrorKind::Other, "size is greater than supported"));
return Err(io::Error::other("size is greater than supported"));
}
let mut description_bytes = vec![0u8; size * 4];

View File

@ -1,4 +1,5 @@
#![allow(clippy::type_complexity)]
#![allow(clippy::result_large_err)]
#[cfg(not(windows))]
#[cfg(test)]

View File

@ -38,7 +38,7 @@ where
let highest_level = get_highest_level(rtxn, db, field_id)?;
if let Some(first_bound) = get_first_facet_value::<BytesRefCodec, _>(rtxn, db, field_id)? {
fd.iterate(candidates, highest_level, first_bound, usize::MAX)?;
let _ = fd.iterate(candidates, highest_level, first_bound, usize::MAX)?;
Ok(())
} else {
Ok(())

View File

@ -225,11 +225,11 @@ impl<'a> Filter<'a> {
Ok(Some(Self { condition }))
}
pub fn use_contains_operator(&self) -> Option<&Token> {
pub fn use_contains_operator(&self) -> Option<&Token<'_>> {
self.condition.use_contains_operator()
}
pub fn use_vector_filter(&self) -> Option<&Token> {
pub fn use_vector_filter(&self) -> Option<&Token<'_>> {
self.condition.use_vector_filter()
}
}

View File

@ -137,7 +137,7 @@ impl<'a> SearchForFacetValues<'a> {
let exact_words_fst = self.search_query.index.exact_words(rtxn)?;
if exact_words_fst.is_some_and(|fst| fst.contains(query)) {
if fst.contains(query) {
self.fetch_original_facets_using_normalized(
let _ = self.fetch_original_facets_using_normalized(
fid,
query,
query,

View File

@ -354,15 +354,14 @@ fn maybe_add_to_results<'ctx, Q: RankingRuleQueryTrait>(
logger.add_to_results(&candidates);
valid_docids.extend_from_slice(&candidates);
valid_scores
.extend(std::iter::repeat(ranking_rule_scores.to_owned()).take(candidates.len()));
.extend(std::iter::repeat_n(ranking_rule_scores.to_owned(), candidates.len()));
}
} else {
// if we have passed the offset already, add some of the documents (up to the limit)
let candidates = candidates.iter().take(length - valid_docids.len()).collect::<Vec<u32>>();
logger.add_to_results(&candidates);
valid_docids.extend_from_slice(&candidates);
valid_scores
.extend(std::iter::repeat(ranking_rule_scores.to_owned()).take(candidates.len()));
valid_scores.extend(std::iter::repeat_n(ranking_rule_scores.to_owned(), candidates.len()));
}
*cur_offset += candidates.len() as usize;

View File

@ -193,6 +193,7 @@ impl<G: RankingRuleGraphTrait> VisitorState<G> {
visit: VisitFn<'_, G>,
ctx: &mut VisitorContext<'_, G>,
) -> Result<ControlFlow<(), bool>> {
#[allow(clippy::manual_contains)] // there is no method contains on mapped interner
if !ctx
.all_costs_from_node
.get(dest_node)
@ -243,6 +244,8 @@ impl<G: RankingRuleGraphTrait> VisitorState<G> {
// Checking that from the destination node, there is at least
// one cost that we can visit that corresponds to our remaining budget.
#[allow(clippy::manual_contains)] // there is no contains on MappedInterner
if !ctx
.all_costs_from_node
.get(dest_node)

View File

@ -401,7 +401,7 @@ impl Iterator for SmallBitmapInternalIter<'_> {
*cur &= *cur - 1;
Some(idx + *base)
} else if next.is_empty() {
return None;
None
} else {
*base += 64;
*cur = next[0];

View File

@ -79,7 +79,7 @@ impl<'ctx, Query> Sort<'ctx, Query> {
return Ok(false);
};
Ok(!displayed_fields.iter().any(|&field| field == field_name))
Ok(!displayed_fields.contains(&field_name))
}
}

View File

@ -52,10 +52,10 @@ const MAX_FRAME_HEADER_SIZE: usize = 9;
/// a message in this queue only if it is empty to avoid filling
/// the channel *and* the BBQueue.
pub fn extractor_writer_bbqueue(
bbbuffers: &mut Vec<BBBuffer>,
bbbuffers: &'_ mut Vec<BBBuffer>,
total_bbbuffer_capacity: usize,
channel_capacity: usize,
) -> (ExtractorBbqueueSender, WriterBbqueueReceiver) {
) -> (ExtractorBbqueueSender<'_>, WriterBbqueueReceiver<'_>) {
let current_num_threads = rayon::current_num_threads();
let bbbuffer_capacity = total_bbbuffer_capacity.checked_div(current_num_threads).unwrap();
bbbuffers.resize_with(current_num_threads, || BBBuffer::new(bbbuffer_capacity));

View File

@ -6,9 +6,7 @@ use rustc_hash::FxBuildHasher;
use serde::de::{DeserializeSeed, Deserializer as _, Visitor};
use serde_json::value::RawValue;
use crate::documents::{
validate_document_id_str, DocumentIdExtractionError, FieldIdMapper, PrimaryKey,
};
use crate::documents::{validate_document_id_str, DocumentIdExtractionError, PrimaryKey};
use crate::fields_ids_map::MutFieldIdMapper;
use crate::{FieldId, UserError};
@ -235,28 +233,6 @@ impl<'de, 'a, Mapper: MutFieldIdMapper> Visitor<'de> for MutFieldIdMapVisitor<'a
}
}
pub struct FieldIdMapVisitor<'a, Mapper: FieldIdMapper>(pub &'a Mapper);
impl<'de, Mapper: FieldIdMapper> Visitor<'de> for FieldIdMapVisitor<'_, Mapper> {
type Value = Option<FieldId>;
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(formatter, "expecting a string")
}
fn visit_borrowed_str<E>(self, v: &'de str) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
Ok(self.0.id(v))
}
fn visit_str<E>(self, v: &str) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
Ok(self.0.id(v))
}
}
pub struct DocumentIdVisitor<'indexer>(pub &'indexer Bump);
impl<'de, 'indexer: 'de> Visitor<'de> for DocumentIdVisitor<'indexer> {

View File

@ -138,7 +138,7 @@ impl<T: MostlySend> ThreadLocal<T> {
self.inner.get_or_default().as_ref()
}
pub fn iter_mut(&mut self) -> IterMut<T> {
pub fn iter_mut(&mut self) -> IterMut<'_, T> {
IterMut(self.inner.iter_mut())
}
}

View File

@ -11,6 +11,7 @@ use crate::ThreadPoolNoAbort;
pub(in crate::vector) const MAX_COMPOSITE_DISTANCE: f32 = 0.01;
#[derive(Debug)]
#[allow(clippy::large_enum_variant)]
pub enum SubEmbedder {
/// An embedder based on running local models, fetched from the Hugging Face Hub.
HuggingFace(hf::Embedder),

View File

@ -19,6 +19,7 @@ use crate::ThreadPoolNoAbort;
/// An embedder can be used to transform text into embeddings.
#[derive(Debug)]
#[allow(clippy::large_enum_variant)]
pub enum Embedder {
/// An embedder based on running local models, fetched from the Hugging Face Hub.
HuggingFace(hf::Embedder),
@ -64,6 +65,7 @@ impl EmbeddingConfig {
/// This type is serialized in and deserialized from the DB, any modification should either go
/// through dumpless upgrade or be backward-compatible
#[derive(Debug, Clone, Hash, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
#[allow(clippy::large_enum_variant)]
pub enum EmbedderOptions {
HuggingFace(hf::EmbedderOptions),
OpenAi(openai::EmbedderOptions),