diff --git a/quickwit/quickwit-actors/src/universe.rs b/quickwit/quickwit-actors/src/universe.rs index e907feb29e8..42cec64aecc 100644 --- a/quickwit/quickwit-actors/src/universe.rs +++ b/quickwit/quickwit-actors/src/universe.rs @@ -28,6 +28,7 @@ use crate::spawn_builder::{SpawnBuilder, SpawnContext}; use crate::{Actor, ActorExitStatus, Command, Inbox, Mailbox, QueueCapacity}; /// Universe serves as the top-level context in which Actor can be spawned. +/// /// It is *not* a singleton. A typical application will usually have only one universe hosting all /// of the actors but it is not a requirement. /// diff --git a/quickwit/quickwit-cli/src/index.rs b/quickwit/quickwit-cli/src/index.rs index 981bff53de2..bd28e4f0b04 100644 --- a/quickwit/quickwit-cli/src/index.rs +++ b/quickwit/quickwit-cli/src/index.rs @@ -1238,7 +1238,7 @@ struct Printer<'a> { pub stdout: &'a mut Stdout, } -impl<'a> Printer<'a> { +impl Printer<'_> { pub fn print_header(&mut self, header: &str) -> io::Result<()> { write!(&mut self.stdout, " {}", header.bright_blue())?; Ok(()) diff --git a/quickwit/quickwit-cli/src/tool.rs b/quickwit/quickwit-cli/src/tool.rs index db22ff1743e..f5b2c512d33 100644 --- a/quickwit/quickwit-cli/src/tool.rs +++ b/quickwit/quickwit-cli/src/tool.rs @@ -841,7 +841,7 @@ struct Printer<'a> { pub stdout: &'a mut Stdout, } -impl<'a> Printer<'a> { +impl Printer<'_> { pub fn print_header(&mut self, header: &str) -> io::Result<()> { write!(&mut self.stdout, " {}", header.bright_blue())?; Ok(()) diff --git a/quickwit/quickwit-common/src/metrics.rs b/quickwit/quickwit-common/src/metrics.rs index 97341d30c67..ef687882c16 100644 --- a/quickwit/quickwit-common/src/metrics.rs +++ b/quickwit/quickwit-common/src/metrics.rs @@ -236,7 +236,7 @@ pub struct GaugeGuard<'a> { delta: i64, } -impl<'a> std::fmt::Debug for GaugeGuard<'a> { +impl std::fmt::Debug for GaugeGuard<'_> { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { self.delta.fmt(f) } @@ -262,7 +262,7 @@ impl<'a> GaugeGuard<'a> { } } -impl<'a> Drop for GaugeGuard<'a> { +impl Drop for GaugeGuard<'_> { fn drop(&mut self) { self.gauge.sub(self.delta) } diff --git a/quickwit/quickwit-common/src/sorted_iter.rs b/quickwit/quickwit-common/src/sorted_iter.rs index 48ebe866bbb..491bf891d8e 100644 --- a/quickwit/quickwit-common/src/sorted_iter.rs +++ b/quickwit/quickwit-common/src/sorted_iter.rs @@ -106,10 +106,10 @@ impl SortedIterator for T where T: Iterator + Sorted {} impl Sorted for btree_map::IntoKeys {} impl Sorted for btree_map::IntoValues {} -impl<'a, K, V> Sorted for btree_map::Keys<'a, K, V> {} -impl<'a, K, V> Sorted for btree_map::Values<'a, K, V> {} +impl Sorted for btree_map::Keys<'_, K, V> {} +impl Sorted for btree_map::Values<'_, K, V> {} impl Sorted for btree_set::IntoIter {} -impl<'a, K> Sorted for btree_set::Iter<'a, K> {} +impl Sorted for btree_set::Iter<'_, K> {} /// Same as [`SortedIterator`] but for (key, value) pairs sorted by key. pub trait SortedByKeyIterator: Iterator + Sized { @@ -194,7 +194,7 @@ where impl SortedByKeyIterator for T where T: Iterator + Sorted {} impl Sorted for btree_map::IntoIter {} -impl<'a, K, V> Sorted for btree_map::Iter<'a, K, V> {} +impl Sorted for btree_map::Iter<'_, K, V> {} #[cfg(test)] mod tests { diff --git a/quickwit/quickwit-common/src/temp_dir.rs b/quickwit/quickwit-common/src/temp_dir.rs index 2c2c08a5848..4b03f6fa79d 100644 --- a/quickwit/quickwit-common/src/temp_dir.rs +++ b/quickwit/quickwit-common/src/temp_dir.rs @@ -82,7 +82,7 @@ pub struct Builder<'a> { num_rand_chars: usize, } -impl<'a> Default for Builder<'a> { +impl Default for Builder<'_> { fn default() -> Self { Self { parts: Default::default(), diff --git a/quickwit/quickwit-control-plane/src/indexing_scheduler/mod.rs b/quickwit/quickwit-control-plane/src/indexing_scheduler/mod.rs index f8df027d8e0..25159da52e3 100644 --- a/quickwit/quickwit-control-plane/src/indexing_scheduler/mod.rs +++ b/quickwit/quickwit-control-plane/src/indexing_scheduler/mod.rs @@ -403,7 +403,7 @@ struct IndexingPlansDiff<'a> { pub unplanned_tasks_by_node_id: FnvHashMap<&'a str, Vec<&'a IndexingTask>>, } -impl<'a> IndexingPlansDiff<'a> { +impl IndexingPlansDiff<'_> { pub fn has_same_nodes(&self) -> bool { self.missing_node_ids.is_empty() && self.unplanned_node_ids.is_empty() } @@ -454,7 +454,7 @@ fn get_shard_locality_metrics( } } -impl<'a> fmt::Debug for IndexingPlansDiff<'a> { +impl fmt::Debug for IndexingPlansDiff<'_> { fn fmt(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { if self.has_same_nodes() && self.has_same_tasks() { return write!(formatter, "EmptyIndexingPlansDiff"); diff --git a/quickwit/quickwit-directories/src/bundle_directory.rs b/quickwit/quickwit-directories/src/bundle_directory.rs index 2ed8dc53706..6284d6d0b72 100644 --- a/quickwit/quickwit-directories/src/bundle_directory.rs +++ b/quickwit/quickwit-directories/src/bundle_directory.rs @@ -49,6 +49,7 @@ impl Debug for BundleDirectory { } /// Loads the split footer from a storage and path. +/// /// Returns (SplitFooter, BundleFooter) /// SplitFooter [BundleMetadata, BundleMetadata Len, Hotcache, Hotcache len] /// BundleFooter [BundleMetadata, BundleMetadata Len] diff --git a/quickwit/quickwit-doc-mapper/src/query_builder.rs b/quickwit/quickwit-doc-mapper/src/query_builder.rs index 02ed11cac3a..dbc663794e5 100644 --- a/quickwit/quickwit-doc-mapper/src/query_builder.rs +++ b/quickwit/quickwit-doc-mapper/src/query_builder.rs @@ -146,7 +146,7 @@ impl<'a> ExtractTermSetFields<'a> { } } -impl<'a, 'b> QueryAstVisitor<'a> for ExtractTermSetFields<'b> { +impl<'a> QueryAstVisitor<'a> for ExtractTermSetFields<'_> { type Err = anyhow::Error; fn visit_term_set(&mut self, term_set_query: &'a TermSetQuery) -> anyhow::Result<()> { diff --git a/quickwit/quickwit-indexing/src/actors/uploader.rs b/quickwit/quickwit-indexing/src/actors/uploader.rs index 3fae76eb01c..f7d09dc3fd7 100644 --- a/quickwit/quickwit-indexing/src/actors/uploader.rs +++ b/quickwit/quickwit-indexing/src/actors/uploader.rs @@ -68,6 +68,7 @@ pub enum UploaderType { } /// [`SplitsUpdateMailbox`] wraps either a [`Mailbox`] or [`Mailbox`]. +/// /// It makes it possible to send a [`SplitsUpdate`] either to the [`Sequencer`] or directly /// to [`Publisher`]. It is used in combination with `SplitsUpdateSender` that will do the send. /// diff --git a/quickwit/quickwit-indexing/src/merge_policy/mod.rs b/quickwit/quickwit-indexing/src/merge_policy/mod.rs index 06519932bbd..e916c9b6ffc 100644 --- a/quickwit/quickwit-indexing/src/merge_policy/mod.rs +++ b/quickwit/quickwit-indexing/src/merge_policy/mod.rs @@ -203,7 +203,7 @@ pub fn nop_merge_policy() -> Arc { struct SplitShortDebug<'a>(&'a SplitMetadata); -impl<'a> fmt::Debug for SplitShortDebug<'a> { +impl fmt::Debug for SplitShortDebug<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("Split") .field("split_id", &self.0.split_id()) diff --git a/quickwit/quickwit-indexing/src/merge_policy/stable_log_merge_policy.rs b/quickwit/quickwit-indexing/src/merge_policy/stable_log_merge_policy.rs index a486ea02cd8..f1a4f4731a2 100644 --- a/quickwit/quickwit-indexing/src/merge_policy/stable_log_merge_policy.rs +++ b/quickwit/quickwit-indexing/src/merge_policy/stable_log_merge_policy.rs @@ -356,7 +356,7 @@ impl StableLogMergePolicy { head + (self.config.merge_factor - 2) }; if tail.is_empty() || num_docs <= first_level_min_saturation_docs as u64 { - return (num_docs as usize + head - 1) / head; + return (num_docs as usize).div_ceil(head); } num_docs -= first_level_min_saturation_docs as u64; self.config.merge_factor - 1 + self.max_num_splits_knowning_levels(num_docs, tail, sorted) diff --git a/quickwit/quickwit-metastore/src/metastore/file_backed/mod.rs b/quickwit/quickwit-metastore/src/metastore/file_backed/mod.rs index 8363551209b..e4593a8e9d6 100644 --- a/quickwit/quickwit-metastore/src/metastore/file_backed/mod.rs +++ b/quickwit/quickwit-metastore/src/metastore/file_backed/mod.rs @@ -1915,7 +1915,7 @@ mod tests { } indexes_json_valid_put -= 1; } - return block_on(ram_storage_clone.put(path, put_payload)); + block_on(ram_storage_clone.put(path, put_payload)) }); let metastore = FileBackedMetastore::for_test(Arc::new(mock_storage)); let index_config = IndexConfig::for_test(index_id, "ram:///indexes/test-index"); @@ -1967,9 +1967,7 @@ mod tests { mock_storage .expect_put() .times(1) - .returning(move |path, put_payload| { - return block_on(ram_storage_clone.put(path, put_payload)); - }); + .returning(move |path, put_payload| block_on(ram_storage_clone.put(path, put_payload))); let metastore = FileBackedMetastore::for_test(Arc::new(mock_storage)); // Delete index @@ -2024,7 +2022,7 @@ mod tests { } indexes_json_valid_put -= 1; } - return block_on(ram_storage_clone.put(path, put_payload)); + block_on(ram_storage_clone.put(path, put_payload)) }); let metastore = FileBackedMetastore::for_test(Arc::new(mock_storage)); diff --git a/quickwit/quickwit-proto/src/codegen/jaeger/jaeger.api_v2.rs b/quickwit/quickwit-proto/src/codegen/jaeger/jaeger.api_v2.rs index b34d2868413..42a2f109167 100644 --- a/quickwit/quickwit-proto/src/codegen/jaeger/jaeger.api_v2.rs +++ b/quickwit/quickwit-proto/src/codegen/jaeger/jaeger.api_v2.rs @@ -92,6 +92,7 @@ pub mod trace { } } /// Note that both Span and Batch may contain a Process. +/// /// This is different from the Thrift model which was only used /// for transport, because Proto model is also used by the backend /// as the domain model, where once a batch is received it is split diff --git a/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.search.rs b/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.search.rs index 189019162f8..473f1ec42f1 100644 --- a/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.search.rs +++ b/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.search.rs @@ -371,6 +371,7 @@ pub struct Hit { pub index_id: ::prost::alloc::string::String, } /// A partial hit, is a hit for which we have not fetch the content yet. +/// /// Instead, it holds a document_uri which is enough information to /// go and fetch the actual document data, by performing a `get_doc(...)` /// request. diff --git a/quickwit/quickwit-proto/src/lib.rs b/quickwit/quickwit-proto/src/lib.rs index 93333e6718e..c5a2aa5034d 100644 --- a/quickwit/quickwit-proto/src/lib.rs +++ b/quickwit/quickwit-proto/src/lib.rs @@ -144,7 +144,7 @@ impl TryFrom for search::SearchRequest { /// `MutMetadataMap` used to extract [`tonic::metadata::MetadataMap`] from a request. pub struct MutMetadataMap<'a>(&'a mut tonic::metadata::MetadataMap); -impl<'a> Injector for MutMetadataMap<'a> { +impl Injector for MutMetadataMap<'_> { /// Sets a key-value pair in the [`MetadataMap`]. No-op if the key or value is invalid. fn set(&mut self, key: &str, value: String) { if let Ok(metadata_key) = tonic::metadata::MetadataKey::from_bytes(key.as_bytes()) { @@ -155,7 +155,7 @@ impl<'a> Injector for MutMetadataMap<'a> { } } -impl<'a> Extractor for MutMetadataMap<'a> { +impl Extractor for MutMetadataMap<'_> { /// Gets a value for a key from the MetadataMap. If the value can't be converted to &str, /// returns None. fn get(&self, key: &str) -> Option<&str> { @@ -195,7 +195,7 @@ impl Interceptor for SpanContextInterceptor { /// tracing keys from request's headers. struct MetadataMap<'a>(&'a tonic::metadata::MetadataMap); -impl<'a> Extractor for MetadataMap<'a> { +impl Extractor for MetadataMap<'_> { /// Gets a value for a key from the MetadataMap. If the value can't be converted to &str, /// returns None. fn get(&self, key: &str) -> Option<&str> { diff --git a/quickwit/quickwit-query/src/json_literal.rs b/quickwit/quickwit-query/src/json_literal.rs index 50990be25c0..37190b4b6dc 100644 --- a/quickwit/quickwit-query/src/json_literal.rs +++ b/quickwit/quickwit-query/src/json_literal.rs @@ -129,7 +129,7 @@ impl<'a> InterpretUserInput<'a> for f64 { } } -impl<'a> InterpretUserInput<'a> for bool { +impl InterpretUserInput<'_> for bool { fn interpret_bool(b: bool) -> Option { Some(b) } @@ -139,14 +139,14 @@ impl<'a> InterpretUserInput<'a> for bool { } } -impl<'a> InterpretUserInput<'a> for Ipv6Addr { +impl InterpretUserInput<'_> for Ipv6Addr { fn interpret_str(text: &str) -> Option { let ip_addr: IpAddr = text.parse().ok()?; Some(ip_addr.into_ipv6_addr()) } } -impl<'a> InterpretUserInput<'a> for tantivy::DateTime { +impl InterpretUserInput<'_> for tantivy::DateTime { fn interpret_str(text: &str) -> Option { let date_time_formats = get_default_date_time_format(); if let Ok(datetime) = parse_date_time_str(text, date_time_formats) { @@ -171,7 +171,7 @@ const LENIENT_BASE64_ENGINE: base64::engine::GeneralPurpose = base64::engine::Ge .with_decode_padding_mode(base64::engine::DecodePaddingMode::Indifferent), ); -impl<'a> InterpretUserInput<'a> for Vec { +impl InterpretUserInput<'_> for Vec { fn interpret_str(mut text: &str) -> Option> { let Some(first_byte) = text.as_bytes().first().copied() else { return Some(Vec::new()); diff --git a/quickwit/quickwit-query/src/tokenizers/chinese_compatible.rs b/quickwit/quickwit-query/src/tokenizers/chinese_compatible.rs index 12e17467a1a..935552dc938 100644 --- a/quickwit/quickwit-query/src/tokenizers/chinese_compatible.rs +++ b/quickwit/quickwit-query/src/tokenizers/chinese_compatible.rs @@ -79,7 +79,7 @@ fn char_grouping(c: char) -> Grouping { } } -impl<'a> TokenStream for ChineseTokenStream<'a> { +impl TokenStream for ChineseTokenStream<'_> { fn advance(&mut self) -> bool { self.token.text.clear(); self.token.position = self.token.position.wrapping_add(1); diff --git a/quickwit/quickwit-query/src/tokenizers/code_tokenizer.rs b/quickwit/quickwit-query/src/tokenizers/code_tokenizer.rs index 1a7dc4092d4..c859490e8b1 100644 --- a/quickwit/quickwit-query/src/tokenizers/code_tokenizer.rs +++ b/quickwit/quickwit-query/src/tokenizers/code_tokenizer.rs @@ -76,7 +76,7 @@ enum AdvanceResult { Backtrack, } -impl<'a> CodeTokenStream<'a> { +impl CodeTokenStream<'_> { fn advance_inner(&mut self, enable_hex: bool) -> bool { // this is cheap, just a copy of a few ptrs and integers let checkpoint = self.chars.clone(); @@ -116,7 +116,7 @@ impl<'a> CodeTokenStream<'a> { } } -impl<'a> TokenStream for CodeTokenStream<'a> { +impl TokenStream for CodeTokenStream<'_> { fn advance(&mut self) -> bool { self.token.text.clear(); self.token.position = self.token.position.wrapping_add(1); @@ -133,7 +133,7 @@ impl<'a> TokenStream for CodeTokenStream<'a> { } } -impl<'a> CodeTokenStream<'a> { +impl CodeTokenStream<'_> { fn update_token(&mut self, token_offsets: Range) { self.token.offset_from = token_offsets.start; self.token.offset_to = token_offsets.end; diff --git a/quickwit/quickwit-query/src/tokenizers/multilang.rs b/quickwit/quickwit-query/src/tokenizers/multilang.rs index cf6d4d87373..41c862561c2 100644 --- a/quickwit/quickwit-query/src/tokenizers/multilang.rs +++ b/quickwit/quickwit-query/src/tokenizers/multilang.rs @@ -153,7 +153,7 @@ pub enum MultiLanguageTokenStream<'a> { Simple(SimpleTokenStream<'a>), } -impl<'a> TokenStream for MultiLanguageTokenStream<'a> { +impl TokenStream for MultiLanguageTokenStream<'_> { fn advance(&mut self) -> bool { match self { MultiLanguageTokenStream::Empty => false, @@ -188,7 +188,7 @@ pub struct LinderaTokenStream<'a> { pub token: &'a mut Token, } -impl<'a> TokenStream for LinderaTokenStream<'a> { +impl TokenStream for LinderaTokenStream<'_> { fn advance(&mut self) -> bool { if self.tokens.is_empty() { return false; diff --git a/quickwit/quickwit-search/src/leaf.rs b/quickwit/quickwit-search/src/leaf.rs index b832230e294..550556a0dd0 100644 --- a/quickwit/quickwit-search/src/leaf.rs +++ b/quickwit/quickwit-search/src/leaf.rs @@ -717,7 +717,7 @@ struct RemoveTimestampRange<'a> { end_timestamp: Bound, } -impl<'a> RemoveTimestampRange<'a> { +impl RemoveTimestampRange<'_> { fn update_start_timestamp( &mut self, lower_bound: &quickwit_query::JsonLiteral, @@ -755,7 +755,7 @@ impl<'a> RemoveTimestampRange<'a> { } } -impl<'a> QueryAstTransformer for RemoveTimestampRange<'a> { +impl QueryAstTransformer for RemoveTimestampRange<'_> { type Err = std::convert::Infallible; fn transform_bool(&mut self, mut bool_query: BoolQuery) -> Result, Self::Err> { diff --git a/quickwit/quickwit-search/src/retry/mod.rs b/quickwit/quickwit-search/src/retry/mod.rs index 72a9e214c30..d02315eaa66 100644 --- a/quickwit/quickwit-search/src/retry/mod.rs +++ b/quickwit/quickwit-search/src/retry/mod.rs @@ -55,7 +55,7 @@ impl RetryPolicy for Default } } -impl<'a> Job for &'a str { +impl Job for &str { fn split_id(&self) -> &str { self } diff --git a/quickwit/quickwit-search/src/root.rs b/quickwit/quickwit-search/src/root.rs index 7dd8dafe366..608bc87e479 100644 --- a/quickwit/quickwit-search/src/root.rs +++ b/quickwit/quickwit-search/src/root.rs @@ -1448,7 +1448,7 @@ struct ExtractTimestampRange<'a> { end_timestamp: Option, } -impl<'a> ExtractTimestampRange<'a> { +impl ExtractTimestampRange<'_> { fn update_start_timestamp( &mut self, lower_bound: &quickwit_query::JsonLiteral, @@ -1489,7 +1489,7 @@ impl<'a> ExtractTimestampRange<'a> { } } -impl<'a, 'b> QueryAstVisitor<'b> for ExtractTimestampRange<'a> { +impl<'b> QueryAstVisitor<'b> for ExtractTimestampRange<'_> { type Err = std::convert::Infallible; fn visit_bool(&mut self, bool_query: &'b BoolQuery) -> Result<(), Self::Err> { diff --git a/quickwit/quickwit-search/src/search_stream/leaf.rs b/quickwit/quickwit-search/src/search_stream/leaf.rs index e56a2bf8494..941e0d12612 100644 --- a/quickwit/quickwit-search/src/search_stream/leaf.rs +++ b/quickwit/quickwit-search/src/search_stream/leaf.rs @@ -362,10 +362,10 @@ impl std::fmt::Display for SearchStreamRequestFields { } } -impl<'a> SearchStreamRequestFields { +impl SearchStreamRequestFields { pub fn from_request( stream_request: &SearchStreamRequest, - schema: &'a Schema, + schema: &Schema, doc_mapper: &DocMapper, ) -> crate::Result { let fast_field = schema.get_field(&stream_request.fast_field)?; diff --git a/quickwit/quickwit-search/src/top_k_collector.rs b/quickwit/quickwit-search/src/top_k_collector.rs index d0371fdf419..56d985dc828 100644 --- a/quickwit/quickwit-search/src/top_k_collector.rs +++ b/quickwit/quickwit-search/src/top_k_collector.rs @@ -508,8 +508,7 @@ where } } -impl<'a, V1, V2, const REVERSE_DOCID: bool> Iterator - for SpecSortingFieldIter<'a, V1, V2, REVERSE_DOCID> +impl Iterator for SpecSortingFieldIter<'_, V1, V2, REVERSE_DOCID> where V1: Copy + PartialEq + Eq + PartialOrd + Ord + IntoOptionU64 + Debug, V2: Copy + PartialEq + Eq + PartialOrd + Ord + IntoOptionU64 + Debug, diff --git a/quickwit/quickwit-serve/src/rest.rs b/quickwit/quickwit-serve/src/rest.rs index a021da9c6f7..3c83c2d84f1 100644 --- a/quickwit/quickwit-serve/src/rest.rs +++ b/quickwit/quickwit-serve/src/rest.rs @@ -294,6 +294,7 @@ fn api_v1_routes( } /// This function returns a formatted error based on the given rejection reason. +/// /// The ordering of rejection processing is very important, we need to start /// with the most specific rejections and end with the most generic. If not, Quickwit /// will return useless errors to the user. diff --git a/quickwit/quickwit-storage/src/cache/slice_address.rs b/quickwit/quickwit-storage/src/cache/slice_address.rs index 8474633767a..09ed5f04a38 100644 --- a/quickwit/quickwit-storage/src/cache/slice_address.rs +++ b/quickwit/quickwit-storage/src/cache/slice_address.rs @@ -53,7 +53,7 @@ impl SliceAddressKey for SliceAddress { } } -impl<'a> SliceAddressKey for SliceAddressRef<'a> { +impl SliceAddressKey for SliceAddressRef<'_> { fn key(&self) -> SliceAddressRef { self.clone() } @@ -64,15 +64,15 @@ impl<'a> Borrow for SliceAddress { self } } -impl<'a> PartialEq for (dyn SliceAddressKey + 'a) { +impl PartialEq for (dyn SliceAddressKey + '_) { fn eq(&self, other: &Self) -> bool { self.key().eq(&other.key()) } } -impl<'a> Eq for (dyn SliceAddressKey + 'a) {} +impl Eq for (dyn SliceAddressKey + '_) {} -impl<'a> Hash for (dyn SliceAddressKey + 'a) { +impl Hash for (dyn SliceAddressKey + '_) { fn hash(&self, state: &mut H) { self.key().hash(state) }