From 26d9070aa73637dcfb8b13d6c9e1fe03d1a489ae Mon Sep 17 00:00:00 2001 From: Tamo Date: Tue, 16 Sep 2025 17:21:33 +0200 Subject: [PATCH] increase rust version from 1.85 to 1.89 --- Dockerfile | 2 +- crates/dump/src/reader/compat/v2_to_v3.rs | 1 + crates/filter-parser/src/condition.rs | 2 +- crates/filter-parser/src/lib.rs | 12 ++++----- crates/index-scheduler/src/dump.rs | 2 ++ crates/index-scheduler/src/error.rs | 1 - crates/index-scheduler/src/lib.rs | 13 +++++----- crates/index-scheduler/src/queue/mod.rs | 2 +- .../src/scheduler/create_batch.rs | 1 + .../src/scheduler/process_export.rs | 2 +- crates/index-scheduler/src/uuid_codec.rs | 2 +- crates/meilisearch-auth/src/store.rs | 4 ++- crates/meilisearch/src/error.rs | 1 + crates/meilisearch/src/lib.rs | 2 ++ .../src/search/federated/perform.rs | 2 +- crates/meilisearch/src/search/mod.rs | 4 +-- crates/meilisearch/src/search_queue.rs | 4 +-- .../tests/auth/tenant_token_multi_search.rs | 9 +++---- crates/meilisearch/tests/vector/mod.rs | 2 +- crates/meilitool/src/uuid_codec.rs | 2 +- crates/milli/src/error.rs | 2 +- .../roaring_bitmap_len_codec.rs | 6 ++--- crates/milli/src/lib.rs | 1 + .../search/facet/facet_distribution_iter.rs | 2 +- crates/milli/src/search/facet/filter.rs | 4 +-- crates/milli/src/search/facet/search.rs | 2 +- crates/milli/src/search/new/bucket_sort.rs | 5 ++-- .../new/ranking_rule_graph/cheapest_paths.rs | 3 +++ crates/milli/src/search/new/small_bitmap.rs | 2 +- crates/milli/src/search/new/sort.rs | 2 +- crates/milli/src/update/new/channel.rs | 4 +-- crates/milli/src/update/new/indexer/de.rs | 26 +------------------ crates/milli/src/update/new/thread_local.rs | 2 +- crates/milli/src/vector/embedder/composite.rs | 1 + crates/milli/src/vector/embedder/mod.rs | 2 ++ rust-toolchain.toml | 2 +- 36 files changed, 63 insertions(+), 73 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5a9a4691f..236033ea1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Compile -FROM rust:1.85-alpine3.20 AS compiler +FROM rust:1.89-alpine3.20 AS compiler RUN apk add -q --no-cache build-base openssl-dev diff --git a/crates/dump/src/reader/compat/v2_to_v3.rs b/crates/dump/src/reader/compat/v2_to_v3.rs index 62326040e..311d802ad 100644 --- a/crates/dump/src/reader/compat/v2_to_v3.rs +++ b/crates/dump/src/reader/compat/v2_to_v3.rs @@ -97,6 +97,7 @@ impl CompatV2ToV3 { } } +#[allow(clippy::large_enum_variant)] pub enum CompatIndexV2ToV3 { V2(v2::V2IndexReader), Compat(Box), diff --git a/crates/filter-parser/src/condition.rs b/crates/filter-parser/src/condition.rs index 8e3c04040..6e9c24ba5 100644 --- a/crates/filter-parser/src/condition.rs +++ b/crates/filter-parser/src/condition.rs @@ -124,7 +124,7 @@ pub fn parse_not_exists(input: Span) -> IResult { Ok((input, FilterCondition::Not(Box::new(FilterCondition::Condition { fid: key, op: Exists })))) } -fn parse_vectors(input: Span) -> IResult<(Token, Option, VectorFilter<'_>)> { +fn parse_vectors(input: Span) -> IResult<(Token, Option, VectorFilter)> { let (input, _) = multispace0(input)?; let (input, fid) = tag("_vectors")(input)?; diff --git a/crates/filter-parser/src/lib.rs b/crates/filter-parser/src/lib.rs index 9ee00c3eb..c46797dd2 100644 --- a/crates/filter-parser/src/lib.rs +++ b/crates/filter-parser/src/lib.rs @@ -116,7 +116,7 @@ impl<'a> Token<'a> { self.span } - pub fn parse_finite_float(&self) -> Result { + pub fn parse_finite_float(&self) -> Result> { let value: f64 = self.value().parse().map_err(|e| self.as_external_error(e))?; if value.is_finite() { Ok(value) @@ -166,7 +166,7 @@ pub enum TraversedElement<'a> { } impl<'a> FilterCondition<'a> { - pub fn use_contains_operator(&self) -> Option<&Token> { + pub fn use_contains_operator(&self) -> Option<&Token<'a>> { match self { FilterCondition::Condition { fid: _, op } => match op { Condition::GreaterThan(_) @@ -193,7 +193,7 @@ impl<'a> FilterCondition<'a> { } } - pub fn use_vector_filter(&self) -> Option<&Token> { + pub fn use_vector_filter(&self) -> Option<&Token<'a>> { match self { FilterCondition::Condition { .. } => None, FilterCondition::Not(this) => this.use_vector_filter(), @@ -207,7 +207,7 @@ impl<'a> FilterCondition<'a> { } } - pub fn fids(&self, depth: usize) -> Box + '_> { + pub fn fids(&self, depth: usize) -> Box> + '_> { if depth == 0 { return Box::new(std::iter::empty()); } @@ -228,7 +228,7 @@ impl<'a> FilterCondition<'a> { } /// Returns the first token found at the specified depth, `None` if no token at this depth. - pub fn token_at_depth(&self, depth: usize) -> Option<&Token> { + pub fn token_at_depth(&self, depth: usize) -> Option<&Token<'a>> { match self { FilterCondition::Condition { fid, .. } if depth == 0 => Some(fid), FilterCondition::Or(subfilters) => { @@ -651,7 +651,7 @@ pub mod tests { /// Create a raw [Token]. You must specify the string that appear BEFORE your element followed by your element pub fn rtok<'a>(before: &'a str, value: &'a str) -> Token<'a> { // if the string is empty we still need to return 1 for the line number - let lines = before.is_empty().then_some(1).unwrap_or_else(|| before.lines().count()); + let lines = if before.is_empty() { 1 } else { before.lines().count() }; let offset = before.chars().count(); // the extra field is not checked in the tests so we can set it to nothing unsafe { Span::new_from_raw_offset(offset, lines as u32, value, "") }.into() diff --git a/crates/index-scheduler/src/dump.rs b/crates/index-scheduler/src/dump.rs index e0866036b..e5e7a5d8c 100644 --- a/crates/index-scheduler/src/dump.rs +++ b/crates/index-scheduler/src/dump.rs @@ -1,3 +1,5 @@ +#![allow(clippy::result_large_err)] + use std::collections::HashMap; use std::io; diff --git a/crates/index-scheduler/src/error.rs b/crates/index-scheduler/src/error.rs index 332b7e040..e67219808 100644 --- a/crates/index-scheduler/src/error.rs +++ b/crates/index-scheduler/src/error.rs @@ -45,7 +45,6 @@ impl From for Code { } } -#[allow(clippy::large_enum_variant)] #[derive(Error, Debug)] pub enum Error { #[error("{1}")] diff --git a/crates/index-scheduler/src/lib.rs b/crates/index-scheduler/src/lib.rs index d6c150dbb..5e31feab8 100644 --- a/crates/index-scheduler/src/lib.rs +++ b/crates/index-scheduler/src/lib.rs @@ -1,3 +1,6 @@ +// The main Error type is large and boxing the large variant make the pattern matching fails +#![allow(clippy::result_large_err)] + /*! This crate defines the index scheduler, which is responsible for: 1. Keeping references to meilisearch's indexes and mapping them to their @@ -344,7 +347,7 @@ impl IndexScheduler { Ok(this) } - fn read_txn(&self) -> Result> { + fn read_txn(&self) -> Result> { self.env.read_txn().map_err(|e| e.into()) } @@ -757,7 +760,7 @@ impl IndexScheduler { /// Register a new task coming from a dump in the scheduler. /// By taking a mutable ref we're pretty sure no one will ever import a dump while actix is running. - pub fn register_dumped_task(&mut self) -> Result { + pub fn register_dumped_task(&mut self) -> Result> { Dump::new(self) } @@ -806,10 +809,8 @@ impl IndexScheduler { .queue .tasks .get_task(self.rtxn, task_id) - .map_err(|err| io::Error::new(io::ErrorKind::Other, err))? - .ok_or_else(|| { - io::Error::new(io::ErrorKind::Other, Error::CorruptedTaskQueue) - })?; + .map_err(io::Error::other)? + .ok_or_else(|| io::Error::other(Error::CorruptedTaskQueue))?; serde_json::to_writer(&mut self.buffer, &TaskView::from_task(&task))?; self.buffer.push(b'\n'); diff --git a/crates/index-scheduler/src/queue/mod.rs b/crates/index-scheduler/src/queue/mod.rs index 4f02edfb2..9f680ff54 100644 --- a/crates/index-scheduler/src/queue/mod.rs +++ b/crates/index-scheduler/src/queue/mod.rs @@ -326,7 +326,7 @@ impl Queue { ); // it's safe to unwrap here because we checked the len above - let newest_task_id = to_delete.iter().last().unwrap(); + let newest_task_id = to_delete.iter().next_back().unwrap(); let last_task_to_delete = self.tasks.get_task(wtxn, newest_task_id)?.ok_or(Error::CorruptedTaskQueue)?; diff --git a/crates/index-scheduler/src/scheduler/create_batch.rs b/crates/index-scheduler/src/scheduler/create_batch.rs index 14aa307cd..c598ad405 100644 --- a/crates/index-scheduler/src/scheduler/create_batch.rs +++ b/crates/index-scheduler/src/scheduler/create_batch.rs @@ -66,6 +66,7 @@ pub(crate) enum DocumentOperation { /// A [batch](Batch) that combines multiple tasks operating on an index. #[derive(Debug)] +#[allow(clippy::large_enum_variant)] pub(crate) enum IndexOperation { DocumentOperation { index_uid: String, diff --git a/crates/index-scheduler/src/scheduler/process_export.rs b/crates/index-scheduler/src/scheduler/process_export.rs index 0cd06f2e4..4d6211523 100644 --- a/crates/index-scheduler/src/scheduler/process_export.rs +++ b/crates/index-scheduler/src/scheduler/process_export.rs @@ -370,7 +370,7 @@ fn ureq_error_into_error(error: ureq::Error) -> Error { } Err(e) => e.into(), }, - ureq::Error::Transport(transport) => io::Error::new(io::ErrorKind::Other, transport).into(), + ureq::Error::Transport(transport) => io::Error::other(transport).into(), } } diff --git a/crates/index-scheduler/src/uuid_codec.rs b/crates/index-scheduler/src/uuid_codec.rs index 92dc70b0c..73d93af7a 100644 --- a/crates/index-scheduler/src/uuid_codec.rs +++ b/crates/index-scheduler/src/uuid_codec.rs @@ -17,7 +17,7 @@ impl<'a> BytesDecode<'a> for UuidCodec { impl BytesEncode<'_> for UuidCodec { type EItem = Uuid; - fn bytes_encode(item: &Self::EItem) -> Result, BoxedError> { + fn bytes_encode(item: &Self::EItem) -> Result, BoxedError> { Ok(Cow::Borrowed(item.as_bytes())) } } diff --git a/crates/meilisearch-auth/src/store.rs b/crates/meilisearch-auth/src/store.rs index 470379e06..919005289 100644 --- a/crates/meilisearch-auth/src/store.rs +++ b/crates/meilisearch-auth/src/store.rs @@ -315,7 +315,9 @@ impl<'a> heed::BytesDecode<'a> for KeyIdActionCodec { impl<'a> heed::BytesEncode<'a> for KeyIdActionCodec { type EItem = (&'a KeyId, &'a Action, Option<&'a [u8]>); - fn bytes_encode((key_id, action, index): &Self::EItem) -> StdResult, BoxedError> { + fn bytes_encode( + (key_id, action, index): &'_ Self::EItem, + ) -> StdResult, BoxedError> { let mut bytes = Vec::new(); bytes.extend_from_slice(key_id.as_bytes()); diff --git a/crates/meilisearch/src/error.rs b/crates/meilisearch/src/error.rs index c90c7c226..a9cc8cc7b 100644 --- a/crates/meilisearch/src/error.rs +++ b/crates/meilisearch/src/error.rs @@ -12,6 +12,7 @@ use tokio::task::JoinError; use crate::routes::indexes::{PROXY_ORIGIN_REMOTE_HEADER, PROXY_ORIGIN_TASK_UID_HEADER}; #[derive(Debug, thiserror::Error)] +#[allow(clippy::large_enum_variant)] pub enum MeilisearchHttpError { #[error("A Content-Type header is missing. Accepted values for the Content-Type header are: {}", .0.iter().map(|s| format!("`{}`", s)).collect::>().join(", "))] diff --git a/crates/meilisearch/src/lib.rs b/crates/meilisearch/src/lib.rs index c24f81742..37c2cb458 100644 --- a/crates/meilisearch/src/lib.rs +++ b/crates/meilisearch/src/lib.rs @@ -1,4 +1,6 @@ +#![allow(clippy::result_large_err)] #![allow(rustdoc::private_intra_doc_links)] + #[macro_use] pub mod error; pub mod analytics; diff --git a/crates/meilisearch/src/search/federated/perform.rs b/crates/meilisearch/src/search/federated/perform.rs index 4988dc07d..1af932c07 100644 --- a/crates/meilisearch/src/search/federated/perform.rs +++ b/crates/meilisearch/src/search/federated/perform.rs @@ -219,7 +219,7 @@ struct SearchResultByQueryIterItem<'a> { fn merge_index_local_results( results_by_query: Vec>, -) -> impl Iterator + '_ { +) -> impl Iterator> + '_ { itertools::kmerge_by( results_by_query.into_iter().map(SearchResultByQueryIter::new), |left: &SearchResultByQueryIterItem, right: &SearchResultByQueryIterItem| { diff --git a/crates/meilisearch/src/search/mod.rs b/crates/meilisearch/src/search/mod.rs index fca8cc3a6..057e469c3 100644 --- a/crates/meilisearch/src/search/mod.rs +++ b/crates/meilisearch/src/search/mod.rs @@ -2080,7 +2080,7 @@ pub(crate) fn parse_filter( facets: &Value, filter_parsing_error_code: Code, features: RoFeatures, -) -> Result, ResponseError> { +) -> Result>, ResponseError> { let filter = match facets { Value::String(expr) => Filter::from_str(expr).map_err(|e| e.into()), Value::Array(arr) => parse_filter_array(arr).map_err(|e| e.into()), @@ -2117,7 +2117,7 @@ pub(crate) fn parse_filter( Ok(filter) } -fn parse_filter_array(arr: &[Value]) -> Result, MeilisearchHttpError> { +fn parse_filter_array(arr: &'_ [Value]) -> Result>, MeilisearchHttpError> { let mut ands = Vec::new(); for value in arr { match value { diff --git a/crates/meilisearch/src/search_queue.rs b/crates/meilisearch/src/search_queue.rs index 9ff8da36c..298ec5ded 100644 --- a/crates/meilisearch/src/search_queue.rs +++ b/crates/meilisearch/src/search_queue.rs @@ -13,9 +13,9 @@ //! What is going to happen at this point is that you're going to send a oneshot::Sender over an async mpsc channel. //! Then, the queue/scheduler is going to either: //! - Drop your oneshot channel => that means there are too many searches going on, and yours won't be executed. -//! You should exit and free all the RAM you use ASAP. +//! You should exit and free all the RAM you use ASAP. //! - Sends you a Permit => that will unlock the method, and you will be able to process your search. -//! And should drop the Permit only once you have freed all the RAM consumed by the method. +//! And should drop the Permit only once you have freed all the RAM consumed by the method. use std::num::NonZeroUsize; use std::sync::atomic::{AtomicUsize, Ordering}; diff --git a/crates/meilisearch/tests/auth/tenant_token_multi_search.rs b/crates/meilisearch/tests/auth/tenant_token_multi_search.rs index 5fd8d29e2..4b75b0471 100644 --- a/crates/meilisearch/tests/auth/tenant_token_multi_search.rs +++ b/crates/meilisearch/tests/auth/tenant_token_multi_search.rs @@ -1040,7 +1040,7 @@ async fn error_single_search_forbidden_token() { ]; let failed_query_indexes: Vec<_> = - std::iter::repeat(Some(0)).take(5).chain(std::iter::repeat(None).take(6)).collect(); + std::iter::repeat_n(Some(0), 5).chain(std::iter::repeat_n(None, 6)).collect(); let failed_query_indexes = vec![failed_query_indexes; ACCEPTED_KEYS_SINGLE.len()]; @@ -1118,10 +1118,9 @@ async fn error_multi_search_forbidden_token() { }, ]; - let failed_query_indexes: Vec<_> = std::iter::repeat(Some(0)) - .take(5) - .chain(std::iter::repeat(Some(1)).take(5)) - .chain(std::iter::repeat(None).take(6)) + let failed_query_indexes: Vec<_> = std::iter::repeat_n(Some(0), 5) + .chain(std::iter::repeat_n(Some(1), 5)) + .chain(std::iter::repeat_n(None, 6)) .collect(); let failed_query_indexes = vec![failed_query_indexes; ACCEPTED_KEYS_BOTH.len()]; diff --git a/crates/meilisearch/tests/vector/mod.rs b/crates/meilisearch/tests/vector/mod.rs index 0ed4f4d3c..41832040b 100644 --- a/crates/meilisearch/tests/vector/mod.rs +++ b/crates/meilisearch/tests/vector/mod.rs @@ -249,7 +249,7 @@ async fn user_provide_mismatched_embedding_dimension() { "###); } -async fn generate_default_user_provided_documents(server: &Server) -> Index { +async fn generate_default_user_provided_documents(server: &Server) -> Index<'_> { let index = server.index("doggo"); let (response, code) = index diff --git a/crates/meilitool/src/uuid_codec.rs b/crates/meilitool/src/uuid_codec.rs index 92dc70b0c..34bc8621e 100644 --- a/crates/meilitool/src/uuid_codec.rs +++ b/crates/meilitool/src/uuid_codec.rs @@ -17,7 +17,7 @@ impl<'a> BytesDecode<'a> for UuidCodec { impl BytesEncode<'_> for UuidCodec { type EItem = Uuid; - fn bytes_encode(item: &Self::EItem) -> Result, BoxedError> { + fn bytes_encode(item: &'_ Self::EItem) -> Result, BoxedError> { Ok(Cow::Borrowed(item.as_bytes())) } } diff --git a/crates/milli/src/error.rs b/crates/milli/src/error.rs index 11d7756c1..2a3fe7390 100644 --- a/crates/milli/src/error.rs +++ b/crates/milli/src/error.rs @@ -621,7 +621,7 @@ impl From 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), } } } diff --git a/crates/milli/src/heed_codec/roaring_bitmap_length/roaring_bitmap_len_codec.rs b/crates/milli/src/heed_codec/roaring_bitmap_length/roaring_bitmap_len_codec.rs index 37567e956..67ed17cb7 100644 --- a/crates/milli/src/heed_codec/roaring_bitmap_length/roaring_bitmap_len_codec.rs +++ b/crates/milli/src/heed_codec/roaring_bitmap_length/roaring_bitmap_len_codec.rs @@ -19,14 +19,14 @@ impl RoaringBitmapLenCodec { if cookie == SERIAL_COOKIE_NO_RUNCONTAINER { (bytes.read_u32::()? 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]; diff --git a/crates/milli/src/lib.rs b/crates/milli/src/lib.rs index ca867d6e0..afe253b85 100644 --- a/crates/milli/src/lib.rs +++ b/crates/milli/src/lib.rs @@ -1,4 +1,5 @@ #![allow(clippy::type_complexity)] +#![allow(clippy::result_large_err)] #[cfg(not(windows))] #[cfg(test)] diff --git a/crates/milli/src/search/facet/facet_distribution_iter.rs b/crates/milli/src/search/facet/facet_distribution_iter.rs index 1e6ea8d88..d6fb2b9f7 100644 --- a/crates/milli/src/search/facet/facet_distribution_iter.rs +++ b/crates/milli/src/search/facet/facet_distribution_iter.rs @@ -38,7 +38,7 @@ where let highest_level = get_highest_level(rtxn, db, field_id)?; if let Some(first_bound) = get_first_facet_value::(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(()) diff --git a/crates/milli/src/search/facet/filter.rs b/crates/milli/src/search/facet/filter.rs index f9262f855..29ebc187c 100644 --- a/crates/milli/src/search/facet/filter.rs +++ b/crates/milli/src/search/facet/filter.rs @@ -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() } } diff --git a/crates/milli/src/search/facet/search.rs b/crates/milli/src/search/facet/search.rs index 3e5fc62f2..018a52dfd 100644 --- a/crates/milli/src/search/facet/search.rs +++ b/crates/milli/src/search/facet/search.rs @@ -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, diff --git a/crates/milli/src/search/new/bucket_sort.rs b/crates/milli/src/search/new/bucket_sort.rs index 645d36e16..50362b85b 100644 --- a/crates/milli/src/search/new/bucket_sort.rs +++ b/crates/milli/src/search/new/bucket_sort.rs @@ -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::>(); 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; diff --git a/crates/milli/src/search/new/ranking_rule_graph/cheapest_paths.rs b/crates/milli/src/search/new/ranking_rule_graph/cheapest_paths.rs index 65580bce5..2ae7fed3b 100644 --- a/crates/milli/src/search/new/ranking_rule_graph/cheapest_paths.rs +++ b/crates/milli/src/search/new/ranking_rule_graph/cheapest_paths.rs @@ -193,6 +193,7 @@ impl VisitorState { visit: VisitFn<'_, G>, ctx: &mut VisitorContext<'_, G>, ) -> Result> { + #[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 VisitorState { // 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) diff --git a/crates/milli/src/search/new/small_bitmap.rs b/crates/milli/src/search/new/small_bitmap.rs index 174aa6d0b..36f7fc719 100644 --- a/crates/milli/src/search/new/small_bitmap.rs +++ b/crates/milli/src/search/new/small_bitmap.rs @@ -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]; diff --git a/crates/milli/src/search/new/sort.rs b/crates/milli/src/search/new/sort.rs index 2fce2d4b5..cefa2c426 100644 --- a/crates/milli/src/search/new/sort.rs +++ b/crates/milli/src/search/new/sort.rs @@ -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)) } } diff --git a/crates/milli/src/update/new/channel.rs b/crates/milli/src/update/new/channel.rs index 884f133d6..71367c1d0 100644 --- a/crates/milli/src/update/new/channel.rs +++ b/crates/milli/src/update/new/channel.rs @@ -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, + bbbuffers: &'_ mut Vec, 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)); diff --git a/crates/milli/src/update/new/indexer/de.rs b/crates/milli/src/update/new/indexer/de.rs index d3ecaeb36..f1c1ada89 100644 --- a/crates/milli/src/update/new/indexer/de.rs +++ b/crates/milli/src/update/new/indexer/de.rs @@ -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; - - fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { - write!(formatter, "expecting a string") - } - fn visit_borrowed_str(self, v: &'de str) -> std::result::Result - where - E: serde::de::Error, - { - Ok(self.0.id(v)) - } - - fn visit_str(self, v: &str) -> std::result::Result - 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> { diff --git a/crates/milli/src/update/new/thread_local.rs b/crates/milli/src/update/new/thread_local.rs index a5af2b0bb..23bbdefd8 100644 --- a/crates/milli/src/update/new/thread_local.rs +++ b/crates/milli/src/update/new/thread_local.rs @@ -138,7 +138,7 @@ impl ThreadLocal { self.inner.get_or_default().as_ref() } - pub fn iter_mut(&mut self) -> IterMut { + pub fn iter_mut(&mut self) -> IterMut<'_, T> { IterMut(self.inner.iter_mut()) } } diff --git a/crates/milli/src/vector/embedder/composite.rs b/crates/milli/src/vector/embedder/composite.rs index dee6a35f1..ac4e2ec4b 100644 --- a/crates/milli/src/vector/embedder/composite.rs +++ b/crates/milli/src/vector/embedder/composite.rs @@ -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), diff --git a/crates/milli/src/vector/embedder/mod.rs b/crates/milli/src/vector/embedder/mod.rs index c6d04059b..52f9e75e8 100644 --- a/crates/milli/src/vector/embedder/mod.rs +++ b/crates/milli/src/vector/embedder/mod.rs @@ -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), diff --git a/rust-toolchain.toml b/rust-toolchain.toml index d5cb5073f..64566fa53 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.85.1" +channel = "1.89.0" components = ["clippy"]