From 21d057059e789d25941460aabcc7d15b11f2883a Mon Sep 17 00:00:00 2001 From: PSeitz Date: Tue, 22 Oct 2024 09:26:54 +0800 Subject: [PATCH] clippy (#2527) * clippy * clippy * clippy * clippy * convert allow to expect and remove unused * cargo fmt * cleanup * export sample * clippy --- bitpacker/src/filter_vec/mod.rs | 1 - columnar/src/block_accessor.rs | 2 +- .../src/column_index/optional_index/set_block/sparse.rs | 2 +- columnar/src/column_values/u128_based/mod.rs | 2 +- columnar/src/columnar/writer/column_operation.rs | 2 +- columnar/src/columnar/writer/mod.rs | 2 +- common/src/lib.rs | 4 ++-- query-grammar/src/infallible.rs | 1 - query-grammar/src/query_grammar.rs | 2 +- src/aggregation/agg_result.rs | 3 ++- src/aggregation/bucket/histogram/date_histogram.rs | 2 +- src/aggregation/bucket/range.rs | 1 + src/aggregation/mod.rs | 4 ++-- src/collector/facet_collector.rs | 4 ++-- src/collector/filter_collector_wrapper.rs | 1 + src/collector/mod.rs | 2 +- src/collector/multi_collector.rs | 4 ++-- src/core/json_utils.rs | 4 ++-- src/directory/directory.rs | 2 +- src/directory/directory_lock.rs | 1 + src/directory/mmap_directory.rs | 2 +- src/directory/watch_event_router.rs | 2 +- src/docset.rs | 2 +- src/fieldnorm/reader.rs | 2 +- src/functional_test.rs | 3 --- src/index/inverted_index_reader.rs | 1 - src/index/segment_component.rs | 1 + src/index/segment_reader.rs | 2 +- src/indexer/delete_queue.rs | 1 - src/indexer/doc_opstamp_mapping.rs | 2 +- src/indexer/log_merge_policy.rs | 2 +- src/indexer/merge_policy.rs | 2 +- src/indexer/segment_writer.rs | 2 +- src/indexer/stamper.rs | 4 ++-- src/lib.rs | 9 +++++---- src/macros.rs | 1 - src/positions/mod.rs | 3 ++- src/postings/compression/mod.rs | 2 +- src/postings/loaded_postings.rs | 2 +- src/postings/mod.rs | 4 ++-- src/postings/recorder.rs | 2 +- src/query/boolean_query/block_wand.rs | 6 +++--- src/query/phrase_prefix_query/phrase_prefix_scorer.rs | 2 +- src/query/phrase_query/mod.rs | 2 +- src/query/range_query/range_query_fastfield.rs | 4 ++-- src/query/vec_docset.rs | 2 +- src/schema/document/de.rs | 2 +- src/schema/document/default_document.rs | 2 +- src/schema/term.rs | 1 + src/snippet/mod.rs | 3 ++- src/space_usage/mod.rs | 2 +- src/store/compression_lz4_block.rs | 4 ++-- src/store/index/skip_index.rs | 2 +- src/store/mod.rs | 2 +- src/termdict/fst_termdict/streamer.rs | 4 ++-- src/termdict/mod.rs | 1 - src/tokenizer/ascii_folding_filter.rs | 2 +- src/tokenizer/facet_tokenizer.rs | 2 +- src/tokenizer/lower_caser.rs | 2 +- src/tokenizer/mod.rs | 2 +- src/tokenizer/ngram_tokenizer.rs | 4 ++-- src/tokenizer/raw_tokenizer.rs | 2 +- src/tokenizer/regex_tokenizer.rs | 3 ++- src/tokenizer/simple_tokenizer.rs | 4 ++-- src/tokenizer/split_compound_words.rs | 4 ++-- src/tokenizer/whitespace_tokenizer.rs | 4 ++-- sstable/src/lib.rs | 2 -- sstable/src/merge/heap_merge.rs | 1 - sstable/src/streamer.rs | 2 +- sstable/src/value/range.rs | 2 +- stacker/src/lib.rs | 1 - stacker/src/memory_arena.rs | 1 - stacker/src/shared_arena_hashmap.rs | 4 ++-- 73 files changed, 87 insertions(+), 91 deletions(-) diff --git a/bitpacker/src/filter_vec/mod.rs b/bitpacker/src/filter_vec/mod.rs index 051b1ae82..5a2ad64fb 100644 --- a/bitpacker/src/filter_vec/mod.rs +++ b/bitpacker/src/filter_vec/mod.rs @@ -35,7 +35,6 @@ const IMPLS: [FilterImplPerInstructionSet; 2] = [ const IMPLS: [FilterImplPerInstructionSet; 1] = [FilterImplPerInstructionSet::Scalar]; impl FilterImplPerInstructionSet { - #[allow(unused_variables)] #[inline] fn from(code: u8) -> FilterImplPerInstructionSet { #[cfg(target_arch = "x86_64")] diff --git a/columnar/src/block_accessor.rs b/columnar/src/block_accessor.rs index d746c598a..b04d640f0 100644 --- a/columnar/src/block_accessor.rs +++ b/columnar/src/block_accessor.rs @@ -66,7 +66,7 @@ impl &'a self, docs: &'a [u32], accessor: &Column, - ) -> impl Iterator + '_ { + ) -> impl Iterator + 'a { if accessor.index.get_cardinality().is_full() { docs.iter().cloned().zip(self.val_cache.iter().cloned()) } else { diff --git a/columnar/src/column_index/optional_index/set_block/sparse.rs b/columnar/src/column_index/optional_index/set_block/sparse.rs index beee7b408..9413d9bd2 100644 --- a/columnar/src/column_index/optional_index/set_block/sparse.rs +++ b/columnar/src/column_index/optional_index/set_block/sparse.rs @@ -82,7 +82,7 @@ impl<'a> SparseBlock<'a> { } #[inline] - #[allow(clippy::comparison_chain)] + #[expect(clippy::comparison_chain)] // Looks for the element in the block. Returns the positions if found. fn binary_search(&self, target: u16) -> Result { let data = &self.0; diff --git a/columnar/src/column_values/u128_based/mod.rs b/columnar/src/column_values/u128_based/mod.rs index 0e827b460..30665630a 100644 --- a/columnar/src/column_values/u128_based/mod.rs +++ b/columnar/src/column_values/u128_based/mod.rs @@ -128,7 +128,7 @@ pub fn open_u128_as_compact_u64(mut bytes: OwnedBytes) -> io::Result From for ColumnOperation { // In order to limit memory usage, and in order // to benefit from the stacker, we do this by serialization our data // as "Symbols". -#[allow(clippy::from_over_into)] +#[expect(clippy::from_over_into)] pub(super) trait SymbolValue: Clone + Copy { // Serializes the symbol into the given buffer. // Returns the number of bytes written into the buffer. diff --git a/columnar/src/columnar/writer/mod.rs b/columnar/src/columnar/writer/mod.rs index 9b118e211..fc82b7793 100644 --- a/columnar/src/columnar/writer/mod.rs +++ b/columnar/src/columnar/writer/mod.rs @@ -392,7 +392,7 @@ impl ColumnarWriter { // Serialize [Dictionary, Column, dictionary num bytes U32::LE] // Column: [Column Index, Column Values, column index num bytes U32::LE] -#[allow(clippy::too_many_arguments)] +#[expect(clippy::too_many_arguments)] fn serialize_bytes_or_str_column( cardinality: Cardinality, num_docs: RowId, diff --git a/common/src/lib.rs b/common/src/lib.rs index cc4db8767..519920c30 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -130,7 +130,7 @@ pub fn replace_in_place(needle: u8, replacement: u8, bytes: &mut [u8]) { } #[cfg(test)] -pub mod test { +pub(crate) mod test { use proptest::prelude::*; @@ -144,7 +144,7 @@ pub mod test { assert_eq!(u64_to_f64(f64_to_u64(val)), val); } - pub fn fixed_size_test() { + pub(crate) fn fixed_size_test() { let mut buffer = Vec::new(); O::default().serialize(&mut buffer).unwrap(); assert_eq!(buffer.len(), O::SIZE_IN_BYTES); diff --git a/query-grammar/src/infallible.rs b/query-grammar/src/infallible.rs index c37cc1238..21025f2f9 100644 --- a/query-grammar/src/infallible.rs +++ b/query-grammar/src/infallible.rs @@ -111,7 +111,6 @@ where F: nom::Parser { Err(Err::Incomplete(needed)) => Err(Err::Incomplete(needed)), // old versions don't understand this is uninhabited and need the empty match to help, // newer versions warn because this arm is unreachable (which it is indeed). - #[allow(unreachable_patterns)] Err(Err::Error(val)) | Err(Err::Failure(val)) => match val {}, } } diff --git a/query-grammar/src/query_grammar.rs b/query-grammar/src/query_grammar.rs index abe51421d..fae63d764 100644 --- a/query-grammar/src/query_grammar.rs +++ b/query-grammar/src/query_grammar.rs @@ -767,7 +767,7 @@ fn occur_leaf(inp: &str) -> IResult<&str, (Option, UserInputAst)> { tuple((fallible(occur_symbol), boosted_leaf))(inp) } -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] fn operand_occur_leaf_infallible( inp: &str, ) -> JResult<&str, (Option, Option, Option)> { diff --git a/src/aggregation/agg_result.rs b/src/aggregation/agg_result.rs index 82d40651d..005568182 100644 --- a/src/aggregation/agg_result.rs +++ b/src/aggregation/agg_result.rs @@ -1,4 +1,5 @@ //! Contains the final aggregation tree. +//! //! This tree can be converted via the `into()` method from `IntermediateAggregationResults`. //! This conversion computes the final result. For example: The intermediate result contains //! intermediate average results, which is the sum and the number of values. The actual average is @@ -187,7 +188,7 @@ pub enum BucketEntries { } impl BucketEntries { - fn iter<'a>(&'a self) -> Box + 'a> { + fn iter<'a>(&'a self) -> Box + 'a> { match self { BucketEntries::Vec(vec) => Box::new(vec.iter()), BucketEntries::HashMap(map) => Box::new(map.values()), diff --git a/src/aggregation/bucket/histogram/date_histogram.rs b/src/aggregation/bucket/histogram/date_histogram.rs index e1ca3426b..a46d71dc4 100644 --- a/src/aggregation/bucket/histogram/date_histogram.rs +++ b/src/aggregation/bucket/histogram/date_histogram.rs @@ -244,7 +244,7 @@ fn parse_into_milliseconds(input: &str) -> Result { } #[cfg(test)] -pub mod tests { +pub(crate) mod tests { use pretty_assertions::assert_eq; use super::*; diff --git a/src/aggregation/bucket/range.rs b/src/aggregation/bucket/range.rs index 9761f610d..96242cc15 100644 --- a/src/aggregation/bucket/range.rs +++ b/src/aggregation/bucket/range.rs @@ -16,6 +16,7 @@ use crate::aggregation::*; use crate::TantivyError; /// Provide user-defined buckets to aggregate on. +/// /// Two special buckets will automatically be created to cover the whole range of values. /// The provided buckets have to be continuous. /// During the aggregation, the values extracted from the fast_field `field` will be checked diff --git a/src/aggregation/mod.rs b/src/aggregation/mod.rs index b87865d88..7b1f21b29 100644 --- a/src/aggregation/mod.rs +++ b/src/aggregation/mod.rs @@ -180,7 +180,7 @@ pub(crate) fn deserialize_option_f64<'de, D>(deserializer: D) -> Result { struct StringOrFloatVisitor; - impl<'de> Visitor<'de> for StringOrFloatVisitor { + impl Visitor<'_> for StringOrFloatVisitor { type Value = Option; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { @@ -226,7 +226,7 @@ pub(crate) fn deserialize_f64<'de, D>(deserializer: D) -> Result where D: Deserializer<'de> { struct StringOrFloatVisitor; - impl<'de> Visitor<'de> for StringOrFloatVisitor { + impl Visitor<'_> for StringOrFloatVisitor { type Value = f64; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/collector/facet_collector.rs b/src/collector/facet_collector.rs index c603c1270..5123ed9c9 100644 --- a/src/collector/facet_collector.rs +++ b/src/collector/facet_collector.rs @@ -13,7 +13,7 @@ struct Hit<'a> { facet: &'a Facet, } -impl<'a> Eq for Hit<'a> {} +impl Eq for Hit<'_> {} impl<'a> PartialEq> for Hit<'a> { fn eq(&self, other: &Hit<'_>) -> bool { @@ -27,7 +27,7 @@ impl<'a> PartialOrd> for Hit<'a> { } } -impl<'a> Ord for Hit<'a> { +impl Ord for Hit<'_> { fn cmp(&self, other: &Self) -> Ordering { other .count diff --git a/src/collector/filter_collector_wrapper.rs b/src/collector/filter_collector_wrapper.rs index 6d084f7b9..167ec980b 100644 --- a/src/collector/filter_collector_wrapper.rs +++ b/src/collector/filter_collector_wrapper.rs @@ -182,6 +182,7 @@ where } /// A variant of the [`FilterCollector`] specialized for bytes fast fields, i.e. +/// /// it transparently wraps an inner [`Collector`] but filters documents /// based on the result of applying the predicate to the bytes fast field. /// diff --git a/src/collector/mod.rs b/src/collector/mod.rs index b78e02072..a31754316 100644 --- a/src/collector/mod.rs +++ b/src/collector/mod.rs @@ -495,4 +495,4 @@ where impl_downcast!(Fruit); #[cfg(test)] -pub mod tests; +pub(crate) mod tests; diff --git a/src/collector/multi_collector.rs b/src/collector/multi_collector.rs index da4d222a9..8077577d2 100644 --- a/src/collector/multi_collector.rs +++ b/src/collector/multi_collector.rs @@ -161,7 +161,7 @@ impl FruitHandle { /// # Ok(()) /// # } /// ``` -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] #[derive(Default)] pub struct MultiCollector<'a> { collector_wrappers: Vec< @@ -190,7 +190,7 @@ impl<'a> MultiCollector<'a> { } } -impl<'a> Collector for MultiCollector<'a> { +impl Collector for MultiCollector<'_> { type Fruit = MultiFruit; type Child = MultiCollectorChild; diff --git a/src/core/json_utils.rs b/src/core/json_utils.rs index 5f40339b7..774bf4440 100644 --- a/src/core/json_utils.rs +++ b/src/core/json_utils.rs @@ -71,7 +71,7 @@ pub fn json_path_sep_to_dot(path: &mut str) { } } -#[allow(clippy::too_many_arguments)] +#[expect(clippy::too_many_arguments)] fn index_json_object<'a, V: Value<'a>>( doc: DocId, json_visitor: V::ObjectIter, @@ -101,7 +101,7 @@ fn index_json_object<'a, V: Value<'a>>( } } -#[allow(clippy::too_many_arguments)] +#[expect(clippy::too_many_arguments)] pub(crate) fn index_json_value<'a, V: Value<'a>>( doc: DocId, json_value: V, diff --git a/src/directory/directory.rs b/src/directory/directory.rs index 73c037971..c740f8ccf 100644 --- a/src/directory/directory.rs +++ b/src/directory/directory.rs @@ -39,7 +39,7 @@ impl RetryPolicy { /// The `DirectoryLock` is an object that represents a file lock. /// /// It is associated with a lock file, that gets deleted on `Drop.` -#[allow(dead_code)] +#[expect(dead_code)] pub struct DirectoryLock(Box); struct DirectoryLockGuard { diff --git a/src/directory/directory_lock.rs b/src/directory/directory_lock.rs index c5ed8ade6..a6321b50b 100644 --- a/src/directory/directory_lock.rs +++ b/src/directory/directory_lock.rs @@ -48,6 +48,7 @@ pub static INDEX_WRITER_LOCK: Lazy = Lazy::new(|| Lock { }); /// The meta lock file is here to protect the segment files being opened by /// `IndexReader::reload()` from being garbage collected. +/// /// It makes it possible for another process to safely consume /// our index in-writing. Ideally, we may have preferred `RWLock` semantics /// here, but it is difficult to achieve on Windows. diff --git a/src/directory/mmap_directory.rs b/src/directory/mmap_directory.rs index 80f1d6a2b..4cd435788 100644 --- a/src/directory/mmap_directory.rs +++ b/src/directory/mmap_directory.rs @@ -244,7 +244,7 @@ impl MmapDirectory { directory_path, ))); } - #[allow(clippy::bind_instead_of_map)] + #[expect(clippy::bind_instead_of_map)] let canonical_path: PathBuf = directory_path.canonicalize().or_else(|io_err| { let directory_path = directory_path.to_owned(); diff --git a/src/directory/watch_event_router.rs b/src/directory/watch_event_router.rs index 28fd83c46..5ddc59a39 100644 --- a/src/directory/watch_event_router.rs +++ b/src/directory/watch_event_router.rs @@ -32,7 +32,7 @@ pub struct WatchCallbackList { /// file change is detected. #[must_use = "This `WatchHandle` controls the lifetime of the watch and should therefore be used."] #[derive(Clone)] -#[allow(dead_code)] +#[expect(dead_code)] pub struct WatchHandle(Arc); impl WatchHandle { diff --git a/src/docset.rs b/src/docset.rs index d04024d45..96ea30709 100644 --- a/src/docset.rs +++ b/src/docset.rs @@ -117,7 +117,7 @@ pub trait DocSet: Send { } } -impl<'a> DocSet for &'a mut dyn DocSet { +impl DocSet for &mut dyn DocSet { fn advance(&mut self) -> u32 { (**self).advance() } diff --git a/src/fieldnorm/reader.rs b/src/fieldnorm/reader.rs index 77ba0086c..07070bb29 100644 --- a/src/fieldnorm/reader.rs +++ b/src/fieldnorm/reader.rs @@ -149,7 +149,7 @@ impl FieldNormReader { } #[cfg(test)] - pub fn for_test(field_norms: &[u32]) -> FieldNormReader { + pub(crate) fn for_test(field_norms: &[u32]) -> FieldNormReader { let field_norms_id = field_norms .iter() .cloned() diff --git a/src/functional_test.rs b/src/functional_test.rs index 2814d8e30..1548d8096 100644 --- a/src/functional_test.rs +++ b/src/functional_test.rs @@ -1,12 +1,9 @@ -#![allow(deprecated)] // Remove with index sorting - use std::collections::HashSet; use rand::{thread_rng, Rng}; use crate::indexer::index_writer::MEMORY_BUDGET_NUM_BYTES_MIN; use crate::schema::*; -#[allow(deprecated)] use crate::{doc, schema, Index, IndexWriter, Searcher}; fn check_index_content(searcher: &Searcher, vals: &[u64]) -> crate::Result<()> { diff --git a/src/index/inverted_index_reader.rs b/src/index/inverted_index_reader.rs index a288df344..30685eaa4 100644 --- a/src/index/inverted_index_reader.rs +++ b/src/index/inverted_index_reader.rs @@ -31,7 +31,6 @@ pub struct InvertedIndexReader { } impl InvertedIndexReader { - #[allow(clippy::needless_pass_by_value)] // for symmetry pub(crate) fn new( termdict: TermDictionary, postings_file_slice: FileSlice, diff --git a/src/index/segment_component.rs b/src/index/segment_component.rs index eb757a80d..42ac1d178 100644 --- a/src/index/segment_component.rs +++ b/src/index/segment_component.rs @@ -1,6 +1,7 @@ use std::slice; /// Enum describing each component of a tantivy segment. +/// /// Each component is stored in its own file, /// using the pattern `segment_uuid`.`component_extension`, /// except the delete component that takes an `segment_uuid`.`delete_opstamp`.`component_extension` diff --git a/src/index/segment_reader.rs b/src/index/segment_reader.rs index 846d94cf0..afb12bf00 100644 --- a/src/index/segment_reader.rs +++ b/src/index/segment_reader.rs @@ -478,7 +478,7 @@ pub fn merge_field_meta_data( .into_iter() .kmerge_by(|left, right| left < right) // TODO: Remove allocation - .group_by(|el| (el.field_name.to_string(), el.typ)) + .chunk_by(|el| (el.field_name.to_string(), el.typ)) { let mut merged: FieldMetadata = group.next().unwrap(); for el in group { diff --git a/src/indexer/delete_queue.rs b/src/indexer/delete_queue.rs index 8700e8135..3aa9f0d85 100644 --- a/src/indexer/delete_queue.rs +++ b/src/indexer/delete_queue.rs @@ -187,7 +187,6 @@ impl DeleteCursor { } } - #[allow(clippy::wrong_self_convention)] fn is_behind_opstamp(&mut self, target_opstamp: Opstamp) -> bool { self.get() .map(|operation| operation.opstamp < target_opstamp) diff --git a/src/indexer/doc_opstamp_mapping.rs b/src/indexer/doc_opstamp_mapping.rs index b209024be..4d4e08583 100644 --- a/src/indexer/doc_opstamp_mapping.rs +++ b/src/indexer/doc_opstamp_mapping.rs @@ -21,7 +21,7 @@ pub enum DocToOpstampMapping<'a> { None, } -impl<'a> DocToOpstampMapping<'a> { +impl DocToOpstampMapping<'_> { /// Assess whether a document should be considered deleted given that it contains /// a deleted term that was deleted at the opstamp: `delete_opstamp`. /// diff --git a/src/indexer/log_merge_policy.rs b/src/indexer/log_merge_policy.rs index 70488285e..86a8fd341 100644 --- a/src/indexer/log_merge_policy.rs +++ b/src/indexer/log_merge_policy.rs @@ -104,7 +104,7 @@ impl MergePolicy for LogMergePolicy { let mut current_max_log_size = f64::MAX; let mut levels = vec![]; - for (_, merge_group) in &size_sorted_segments.into_iter().group_by(|segment| { + for (_, merge_group) in &size_sorted_segments.into_iter().chunk_by(|segment| { let segment_log_size = f64::from(self.clip_min_size(segment.num_docs())).log2(); if segment_log_size < (current_max_log_size - self.level_log_size) { // update current_max_log_size to create a new group diff --git a/src/indexer/merge_policy.rs b/src/indexer/merge_policy.rs index 4215caaac..f0befd995 100644 --- a/src/indexer/merge_policy.rs +++ b/src/indexer/merge_policy.rs @@ -36,7 +36,7 @@ impl MergePolicy for NoMergePolicy { } #[cfg(test)] -pub mod tests { +pub(crate) mod tests { use super::*; diff --git a/src/indexer/segment_writer.rs b/src/indexer/segment_writer.rs index 1ab320006..99976b2a3 100644 --- a/src/indexer/segment_writer.rs +++ b/src/indexer/segment_writer.rs @@ -150,7 +150,7 @@ impl SegmentWriter { let vals_grouped_by_field = doc .iter_fields_and_values() .sorted_by_key(|(field, _)| *field) - .group_by(|(field, _)| *field); + .chunk_by(|(field, _)| *field); for (field, field_values) in &vals_grouped_by_field { let values = field_values.map(|el| el.1); diff --git a/src/indexer/stamper.rs b/src/indexer/stamper.rs index 733aab82a..5df450fc8 100644 --- a/src/indexer/stamper.rs +++ b/src/indexer/stamper.rs @@ -101,7 +101,7 @@ mod test { use super::Stamper; - #[allow(clippy::redundant_clone)] + #[expect(clippy::redundant_clone)] #[test] fn test_stamper() { let stamper = Stamper::new(7u64); @@ -117,7 +117,7 @@ mod test { assert_eq!(stamper.stamp(), 15u64); } - #[allow(clippy::redundant_clone)] + #[expect(clippy::redundant_clone)] #[test] fn test_stamper_revert() { let stamper = Stamper::new(7u64); diff --git a/src/lib.rs b/src/lib.rs index df6ba8d3c..cf4308d55 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -178,10 +178,8 @@ pub use crate::future_result::FutureResult; pub type Result = std::result::Result; mod core; -#[allow(deprecated)] // Remove with index sorting pub mod indexer; -#[allow(unused_doc_comments)] pub mod error; pub mod tokenizer; @@ -190,7 +188,6 @@ pub mod collector; pub mod directory; pub mod fastfield; pub mod fieldnorm; -#[allow(deprecated)] // Remove with index sorting pub mod index; pub mod positions; pub mod postings; @@ -223,7 +220,6 @@ pub use self::docset::{DocSet, COLLECT_BLOCK_BUFFER_LEN, TERMINATED}; pub use crate::core::json_utils; pub use crate::core::{Executor, Searcher, SearcherGeneration}; pub use crate::directory::Directory; -#[allow(deprecated)] // Remove with index sorting pub use crate::index::{ Index, IndexBuilder, IndexMeta, IndexSettings, InvertedIndexReader, Order, Segment, SegmentMeta, SegmentReader, @@ -371,6 +367,7 @@ macro_rules! fail_point { }}; } +/// Common test utilities. #[cfg(test)] pub mod tests { use common::{BinarySerializable, FixedSize}; @@ -389,6 +386,7 @@ pub mod tests { use crate::schema::*; use crate::{DateTime, DocAddress, Index, IndexWriter, ReloadPolicy}; + /// Asserts that the serialized value is the value in the trait. pub fn fixed_size_test() { let mut buffer = Vec::new(); O::default().serialize(&mut buffer).unwrap(); @@ -421,6 +419,7 @@ pub mod tests { }}; } + /// Generates random numbers pub fn generate_nonunique_unsorted(max_value: u32, n_elems: usize) -> Vec { let seed: [u8; 32] = [1; 32]; StdRng::from_seed(seed) @@ -429,6 +428,7 @@ pub mod tests { .collect::>() } + /// Sample `n` elements with Bernoulli distribution. pub fn sample_with_seed(n: u32, ratio: f64, seed_val: u8) -> Vec { StdRng::from_seed([seed_val; 32]) .sample_iter(&Bernoulli::new(ratio).unwrap()) @@ -438,6 +438,7 @@ pub mod tests { .collect() } + /// Sample `n` elements with Bernoulli distribution. pub fn sample(n: u32, ratio: f64) -> Vec { sample_with_seed(n, ratio, 4) } diff --git a/src/macros.rs b/src/macros.rs index ad32154d5..fa4953f94 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -41,7 +41,6 @@ /// ); /// # } /// ``` - #[macro_export] macro_rules! doc( () => { diff --git a/src/positions/mod.rs b/src/positions/mod.rs index a02ce71be..c1b7c14e3 100644 --- a/src/positions/mod.rs +++ b/src/positions/mod.rs @@ -1,4 +1,5 @@ //! Tantivy can (if instructed to do so in the schema) store the term positions in a given field. +//! //! This position is expressed as token ordinal. For instance, //! In "The beauty and the beast", the term "the" appears in position 0 and position 3. //! This information is useful to run phrase queries. @@ -38,7 +39,7 @@ pub use self::serializer::PositionSerializer; const COMPRESSION_BLOCK_SIZE: usize = BitPacker4x::BLOCK_LEN; #[cfg(test)] -pub mod tests { +pub(crate) mod tests { use std::iter; diff --git a/src/postings/compression/mod.rs b/src/postings/compression/mod.rs index 3928be51b..e343c7406 100644 --- a/src/postings/compression/mod.rs +++ b/src/postings/compression/mod.rs @@ -264,7 +264,7 @@ impl VIntDecoder for BlockDecoder { } #[cfg(test)] -pub mod tests { +pub(crate) mod tests { use super::*; use crate::TERMINATED; diff --git a/src/postings/loaded_postings.rs b/src/postings/loaded_postings.rs index 7212be4ac..7258f5cea 100644 --- a/src/postings/loaded_postings.rs +++ b/src/postings/loaded_postings.rs @@ -104,7 +104,7 @@ impl Postings for LoadedPostings { } #[cfg(test)] -pub mod tests { +pub(crate) mod tests { use super::*; diff --git a/src/postings/mod.rs b/src/postings/mod.rs index 7060916bd..4dee06aad 100644 --- a/src/postings/mod.rs +++ b/src/postings/mod.rs @@ -31,7 +31,7 @@ pub use self::serializer::{FieldSerializer, InvertedIndexSerializer}; pub(crate) use self::skip::{BlockInfo, SkipReader}; pub use self::term_info::TermInfo; -#[allow(clippy::enum_variant_names)] +#[expect(clippy::enum_variant_names)] #[derive(Debug, PartialEq, Clone, Copy, Eq)] pub(crate) enum FreqReadingOption { NoFreq, @@ -40,7 +40,7 @@ pub(crate) enum FreqReadingOption { } #[cfg(test)] -pub mod tests { +pub(crate) mod tests { use std::mem; use super::{InvertedIndexSerializer, Postings}; diff --git a/src/postings/recorder.rs b/src/postings/recorder.rs index de7a400f5..58610c139 100644 --- a/src/postings/recorder.rs +++ b/src/postings/recorder.rs @@ -34,7 +34,7 @@ impl<'a> VInt32Reader<'a> { } } -impl<'a> Iterator for VInt32Reader<'a> { +impl Iterator for VInt32Reader<'_> { type Item = u32; fn next(&mut self) -> Option { diff --git a/src/query/boolean_query/block_wand.rs b/src/query/boolean_query/block_wand.rs index 59e22caa1..77febab31 100644 --- a/src/query/boolean_query/block_wand.rs +++ b/src/query/boolean_query/block_wand.rs @@ -272,7 +272,7 @@ impl<'a> From<&'a mut TermScorer> for TermScorerWithMaxScore<'a> { } } -impl<'a> Deref for TermScorerWithMaxScore<'a> { +impl Deref for TermScorerWithMaxScore<'_> { type Target = TermScorer; fn deref(&self) -> &Self::Target { @@ -280,7 +280,7 @@ impl<'a> Deref for TermScorerWithMaxScore<'a> { } } -impl<'a> DerefMut for TermScorerWithMaxScore<'a> { +impl DerefMut for TermScorerWithMaxScore<'_> { fn deref_mut(&mut self) -> &mut Self::Target { self.scorer } @@ -417,7 +417,7 @@ mod tests { .boxed() } - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] fn gen_term_scorers(num_scorers: usize) -> BoxedStrategy<(Vec>, Vec)> { (1u32..100u32) .prop_flat_map(move |max_doc: u32| { diff --git a/src/query/phrase_prefix_query/phrase_prefix_scorer.rs b/src/query/phrase_prefix_query/phrase_prefix_scorer.rs index 814965b25..09cf6c5bd 100644 --- a/src/query/phrase_prefix_query/phrase_prefix_scorer.rs +++ b/src/query/phrase_prefix_query/phrase_prefix_scorer.rs @@ -8,7 +8,7 @@ use crate::{DocId, Score}; // MultiPrefix is the larger variant, and also the one we expect most often. PhraseScorer is > 1kB // though, it would be interesting to slim it down if possible. -#[allow(clippy::large_enum_variant)] +#[expect(clippy::large_enum_variant)] enum PhraseKind { SinglePrefix { position_offset: u32, diff --git a/src/query/phrase_query/mod.rs b/src/query/phrase_query/mod.rs index f37c39b15..938e34442 100644 --- a/src/query/phrase_query/mod.rs +++ b/src/query/phrase_query/mod.rs @@ -10,7 +10,7 @@ pub use self::phrase_scorer::PhraseScorer; pub use self::phrase_weight::PhraseWeight; #[cfg(test)] -pub mod tests { +pub(crate) mod tests { use serde_json::json; diff --git a/src/query/range_query/range_query_fastfield.rs b/src/query/range_query/range_query_fastfield.rs index 3fdb217e7..ef34915e8 100644 --- a/src/query/range_query/range_query_fastfield.rs +++ b/src/query/range_query/range_query_fastfield.rs @@ -402,7 +402,7 @@ fn search_on_u64_ff( boost: Score, bounds: BoundsRange, ) -> crate::Result> { - #[allow(clippy::reversed_empty_ranges)] + #[expect(clippy::reversed_empty_ranges)] let value_range = bound_to_value_range( &bounds.lower_bound, &bounds.upper_bound, @@ -1386,7 +1386,7 @@ mod tests { } #[cfg(test)] -pub mod ip_range_tests { +pub(crate) mod ip_range_tests { use proptest::prelude::ProptestConfig; use proptest::strategy::Strategy; use proptest::{prop_oneof, proptest}; diff --git a/src/query/vec_docset.rs b/src/query/vec_docset.rs index 5c87a71ce..9dafa3ffd 100644 --- a/src/query/vec_docset.rs +++ b/src/query/vec_docset.rs @@ -50,7 +50,7 @@ impl HasLen for VecDocSet { } #[cfg(test)] -pub mod tests { +pub(crate) mod tests { use super::*; use crate::docset::COLLECT_BLOCK_BUFFER_LEN; diff --git a/src/schema/document/de.rs b/src/schema/document/de.rs index 01ab0afdc..02ee7a6a0 100644 --- a/src/schema/document/de.rs +++ b/src/schema/document/de.rs @@ -394,7 +394,7 @@ where R: Read type_codes::NULL_CODE => ValueType::Null, type_codes::ARRAY_CODE => ValueType::Array, type_codes::OBJECT_CODE => ValueType::Object, - #[allow(deprecated)] + #[expect(deprecated)] type_codes::JSON_OBJ_CODE => ValueType::JSONObject, _ => { return Err(DeserializeError::from(io::Error::new( diff --git a/src/schema/document/default_document.rs b/src/schema/document/default_document.rs index f3abb4001..2c3486800 100644 --- a/src/schema/document/default_document.rs +++ b/src/schema/document/default_document.rs @@ -401,7 +401,7 @@ impl PartialEq for CompactDocValue<'_> { value1 == value2 } } -impl<'a> From> for OwnedValue { +impl From> for OwnedValue { fn from(value: CompactDocValue) -> Self { value.as_value().into() } diff --git a/src/schema/term.rs b/src/schema/term.rs index 37434b2d4..0d6305665 100644 --- a/src/schema/term.rs +++ b/src/schema/term.rs @@ -331,6 +331,7 @@ where B: AsRef<[u8]> } /// ValueBytes represents a serialized value. +/// /// The value can be of any type of [`Type`] (e.g. string, u64, f64, bool, date, JSON). /// The serialized representation matches the lexicographical order of the type. /// diff --git a/src/snippet/mod.rs b/src/snippet/mod.rs index e749e7fba..020e6b588 100644 --- a/src/snippet/mod.rs +++ b/src/snippet/mod.rs @@ -1,5 +1,6 @@ //! [`SnippetGenerator`] //! Generates a text snippet for a given document, and some highlighted parts inside it. +//! //! Imagine you doing a text search in a document //! and want to show a preview of where in the document the search terms occur, //! along with some surrounding text to give context, and the search terms highlighted. @@ -436,7 +437,7 @@ impl SnippetGenerator { } #[cfg(test)] - pub fn terms_text(&self) -> &BTreeMap { + pub(crate) fn terms_text(&self) -> &BTreeMap { &self.terms_text } diff --git a/src/space_usage/mod.rs b/src/space_usage/mod.rs index 238ada60f..70291153a 100644 --- a/src/space_usage/mod.rs +++ b/src/space_usage/mod.rs @@ -78,7 +78,7 @@ pub struct SegmentSpaceUsage { } impl SegmentSpaceUsage { - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] pub(crate) fn new( num_docs: u32, termdict: PerFieldSpaceUsage, diff --git a/src/store/compression_lz4_block.rs b/src/store/compression_lz4_block.rs index 44d54a3dd..ee904470c 100644 --- a/src/store/compression_lz4_block.rs +++ b/src/store/compression_lz4_block.rs @@ -4,7 +4,7 @@ use std::mem; use lz4_flex::{compress_into, decompress_into}; #[inline] -#[allow(clippy::uninit_vec)] +#[expect(clippy::uninit_vec)] pub fn compress(uncompressed: &[u8], compressed: &mut Vec) -> io::Result<()> { compressed.clear(); let maximum_output_size = @@ -24,7 +24,7 @@ pub fn compress(uncompressed: &[u8], compressed: &mut Vec) -> io::Result<()> } #[inline] -#[allow(clippy::uninit_vec)] +#[expect(clippy::uninit_vec)] pub fn decompress(compressed: &[u8], decompressed: &mut Vec) -> io::Result<()> { decompressed.clear(); let uncompressed_size_bytes: &[u8; 4] = compressed diff --git a/src/store/index/skip_index.rs b/src/store/index/skip_index.rs index 5eafb2814..46b30dae1 100644 --- a/src/store/index/skip_index.rs +++ b/src/store/index/skip_index.rs @@ -11,7 +11,7 @@ pub struct LayerCursor<'a> { cursor: usize, } -impl<'a> Iterator for LayerCursor<'a> { +impl Iterator for LayerCursor<'_> { type Item = Checkpoint; fn next(&mut self) -> Option { diff --git a/src/store/mod.rs b/src/store/mod.rs index 2a960ff1c..582643515 100644 --- a/src/store/mod.rs +++ b/src/store/mod.rs @@ -53,7 +53,7 @@ mod compression_lz4_block; mod compression_zstd_block; #[cfg(test)] -pub mod tests { +pub(crate) mod tests { use std::path::Path; diff --git a/src/termdict/fst_termdict/streamer.rs b/src/termdict/fst_termdict/streamer.rs index 90d3c5ce8..d2e31421f 100644 --- a/src/termdict/fst_termdict/streamer.rs +++ b/src/termdict/fst_termdict/streamer.rs @@ -82,7 +82,7 @@ where A: Automaton current_value: TermInfo, } -impl<'a, A> TermStreamer<'a, A> +impl TermStreamer<'_, A> where A: Automaton { /// Advance position the stream on the next item. @@ -136,7 +136,7 @@ where A: Automaton } /// Return the next `(key, value)` pair. - #[allow(clippy::should_implement_trait)] + #[expect(clippy::should_implement_trait)] pub fn next(&mut self) -> Option<(&[u8], &TermInfo)> { if self.advance() { Some((self.key(), self.value())) diff --git a/src/termdict/mod.rs b/src/termdict/mod.rs index 199c55e3c..01c9591ee 100644 --- a/src/termdict/mod.rs +++ b/src/termdict/mod.rs @@ -49,7 +49,6 @@ use crate::postings::TermInfo; #[derive(Debug, Eq, PartialEq)] #[repr(u32)] -#[allow(dead_code)] enum DictionaryType { Fst = 1, SSTable = 2, diff --git a/src/tokenizer/ascii_folding_filter.rs b/src/tokenizer/ascii_folding_filter.rs index da8039e17..7267fb753 100644 --- a/src/tokenizer/ascii_folding_filter.rs +++ b/src/tokenizer/ascii_folding_filter.rs @@ -42,7 +42,7 @@ pub struct AsciiFoldingFilterTokenStream<'a, T> { tail: T, } -impl<'a, T: TokenStream> TokenStream for AsciiFoldingFilterTokenStream<'a, T> { +impl TokenStream for AsciiFoldingFilterTokenStream<'_, T> { fn advance(&mut self) -> bool { if !self.tail.advance() { return false; diff --git a/src/tokenizer/facet_tokenizer.rs b/src/tokenizer/facet_tokenizer.rs index db0df294d..089839367 100644 --- a/src/tokenizer/facet_tokenizer.rs +++ b/src/tokenizer/facet_tokenizer.rs @@ -40,7 +40,7 @@ impl Tokenizer for FacetTokenizer { } } -impl<'a> TokenStream for FacetTokenStream<'a> { +impl TokenStream for FacetTokenStream<'_> { fn advance(&mut self) -> bool { match self.state { State::RootFacetNotEmitted => { diff --git a/src/tokenizer/lower_caser.rs b/src/tokenizer/lower_caser.rs index 56792ba82..02b42be62 100644 --- a/src/tokenizer/lower_caser.rs +++ b/src/tokenizer/lower_caser.rs @@ -51,7 +51,7 @@ fn to_lowercase_unicode(text: &str, output: &mut String) { } } -impl<'a, T: TokenStream> TokenStream for LowerCaserTokenStream<'a, T> { +impl TokenStream for LowerCaserTokenStream<'_, T> { fn advance(&mut self) -> bool { if !self.tail.advance() { return false; diff --git a/src/tokenizer/mod.rs b/src/tokenizer/mod.rs index 23f7893d2..5a5435562 100644 --- a/src/tokenizer/mod.rs +++ b/src/tokenizer/mod.rs @@ -166,7 +166,7 @@ pub use self::whitespace_tokenizer::WhitespaceTokenizer; pub const MAX_TOKEN_LEN: usize = u16::MAX as usize - 5; #[cfg(test)] -pub mod tests { +pub(crate) mod tests { use super::{ Language, LowerCaser, RemoveLongFilter, SimpleTokenizer, Stemmer, Token, TokenizerManager, }; diff --git a/src/tokenizer/ngram_tokenizer.rs b/src/tokenizer/ngram_tokenizer.rs index 9dac2c5c5..b975efc4f 100644 --- a/src/tokenizer/ngram_tokenizer.rs +++ b/src/tokenizer/ngram_tokenizer.rs @@ -159,7 +159,7 @@ impl Tokenizer for NgramTokenizer { } } -impl<'a> TokenStream for NgramTokenStream<'a> { +impl TokenStream for NgramTokenStream<'_> { fn advance(&mut self) -> bool { if let Some((offset_from, offset_to)) = self.ngram_charidx_iterator.next() { if self.prefix_only && offset_from > 0 { @@ -283,7 +283,7 @@ impl<'a> CodepointFrontiers<'a> { } } -impl<'a> Iterator for CodepointFrontiers<'a> { +impl Iterator for CodepointFrontiers<'_> { type Item = usize; fn next(&mut self) -> Option { diff --git a/src/tokenizer/raw_tokenizer.rs b/src/tokenizer/raw_tokenizer.rs index 9bf7ee22a..dc918bcc9 100644 --- a/src/tokenizer/raw_tokenizer.rs +++ b/src/tokenizer/raw_tokenizer.rs @@ -28,7 +28,7 @@ impl Tokenizer for RawTokenizer { } } -impl<'a> TokenStream for RawTokenStream<'a> { +impl TokenStream for RawTokenStream<'_> { fn advance(&mut self) -> bool { let result = self.has_token; self.has_token = false; diff --git a/src/tokenizer/regex_tokenizer.rs b/src/tokenizer/regex_tokenizer.rs index f9a10ad20..2ab5198eb 100644 --- a/src/tokenizer/regex_tokenizer.rs +++ b/src/tokenizer/regex_tokenizer.rs @@ -4,6 +4,7 @@ use super::{Token, TokenStream, Tokenizer}; use crate::TantivyError; /// Tokenize the text by using a regex pattern to split. +/// /// Each match of the regex emits a distinct token, empty tokens will not be emitted. Anchors such /// as `\A` will match the text from the part where the last token was emitted or the beginning of /// the complete text if no token was emitted yet. @@ -83,7 +84,7 @@ pub struct RegexTokenStream<'a> { cursor: usize, } -impl<'a> TokenStream for RegexTokenStream<'a> { +impl TokenStream for RegexTokenStream<'_> { fn advance(&mut self) -> bool { let Some(regex_match) = self.regex.find(self.text) else { return false; diff --git a/src/tokenizer/simple_tokenizer.rs b/src/tokenizer/simple_tokenizer.rs index 540dfac47..0bd00ecc6 100644 --- a/src/tokenizer/simple_tokenizer.rs +++ b/src/tokenizer/simple_tokenizer.rs @@ -27,7 +27,7 @@ impl Tokenizer for SimpleTokenizer { } } -impl<'a> SimpleTokenStream<'a> { +impl SimpleTokenStream<'_> { // search for the end of the current token. fn search_token_end(&mut self) -> usize { (&mut self.chars) @@ -38,7 +38,7 @@ impl<'a> SimpleTokenStream<'a> { } } -impl<'a> TokenStream for SimpleTokenStream<'a> { +impl TokenStream for SimpleTokenStream<'_> { fn advance(&mut self) -> bool { self.token.text.clear(); self.token.position = self.token.position.wrapping_add(1); diff --git a/src/tokenizer/split_compound_words.rs b/src/tokenizer/split_compound_words.rs index 5ee244f01..489afd7b2 100644 --- a/src/tokenizer/split_compound_words.rs +++ b/src/tokenizer/split_compound_words.rs @@ -122,7 +122,7 @@ pub struct SplitCompoundWordsTokenStream<'a, T> { parts: &'a mut Vec, } -impl<'a, T: TokenStream> SplitCompoundWordsTokenStream<'a, T> { +impl SplitCompoundWordsTokenStream<'_, T> { // Will use `self.cuts` to fill `self.parts` if `self.tail.token()` // can fully be split into consecutive matches against `self.dict`. fn split(&mut self) { @@ -158,7 +158,7 @@ impl<'a, T: TokenStream> SplitCompoundWordsTokenStream<'a, T> { } } -impl<'a, T: TokenStream> TokenStream for SplitCompoundWordsTokenStream<'a, T> { +impl TokenStream for SplitCompoundWordsTokenStream<'_, T> { fn advance(&mut self) -> bool { self.parts.pop(); diff --git a/src/tokenizer/whitespace_tokenizer.rs b/src/tokenizer/whitespace_tokenizer.rs index 69a3b0550..4f1951f6e 100644 --- a/src/tokenizer/whitespace_tokenizer.rs +++ b/src/tokenizer/whitespace_tokenizer.rs @@ -26,7 +26,7 @@ impl Tokenizer for WhitespaceTokenizer { } } -impl<'a> WhitespaceTokenStream<'a> { +impl WhitespaceTokenStream<'_> { // search for the end of the current token. fn search_token_end(&mut self) -> usize { (&mut self.chars) @@ -37,7 +37,7 @@ impl<'a> WhitespaceTokenStream<'a> { } } -impl<'a> TokenStream for WhitespaceTokenStream<'a> { +impl TokenStream for WhitespaceTokenStream<'_> { fn advance(&mut self) -> bool { self.token.text.clear(); self.token.position = self.token.position.wrapping_add(1); diff --git a/sstable/src/lib.rs b/sstable/src/lib.rs index 5d529f6d6..adcff4939 100644 --- a/sstable/src/lib.rs +++ b/sstable/src/lib.rs @@ -85,7 +85,6 @@ pub trait SSTable: Sized { } } -#[allow(dead_code)] pub struct VoidSSTable; impl SSTable for VoidSSTable { @@ -100,7 +99,6 @@ impl SSTable for VoidSSTable { /// In other words, two keys `k1` and `k2` /// such that `k1` <= `k2`, are required to observe /// `range_sstable[k1] <= range_sstable[k2]`. -#[allow(dead_code)] pub struct MonotonicU64SSTable; impl SSTable for MonotonicU64SSTable { diff --git a/sstable/src/merge/heap_merge.rs b/sstable/src/merge/heap_merge.rs index e1742f91c..0123c4fe8 100644 --- a/sstable/src/merge/heap_merge.rs +++ b/sstable/src/merge/heap_merge.rs @@ -26,7 +26,6 @@ impl> PartialEq for HeapItem { } } -#[allow(dead_code)] pub fn merge_sstable>( readers: Vec>, mut writer: Writer, diff --git a/sstable/src/streamer.rs b/sstable/src/streamer.rs index 2691b36a5..66e31ace1 100644 --- a/sstable/src/streamer.rs +++ b/sstable/src/streamer.rs @@ -264,7 +264,7 @@ where } /// Return the next `(key, value)` pair. - #[allow(clippy::should_implement_trait)] + #[expect(clippy::should_implement_trait)] pub fn next(&mut self) -> Option<(&[u8], &TSSTable::Value)> { if self.advance() { Some((self.key(), self.value())) diff --git a/sstable/src/value/range.rs b/sstable/src/value/range.rs index ca24a4be7..2fff531c1 100644 --- a/sstable/src/value/range.rs +++ b/sstable/src/value/range.rs @@ -78,7 +78,7 @@ impl ValueWriter for RangeValueWriter { } #[cfg(test)] -#[allow(clippy::single_range_in_vec_init)] +#[expect(clippy::single_range_in_vec_init)] mod tests { use super::*; diff --git a/stacker/src/lib.rs b/stacker/src/lib.rs index 64945c248..9e29d2d5b 100644 --- a/stacker/src/lib.rs +++ b/stacker/src/lib.rs @@ -5,7 +5,6 @@ extern crate test; mod arena_hashmap; mod expull; -#[allow(dead_code)] mod fastcmp; mod fastcpy; mod memory_arena; diff --git a/stacker/src/memory_arena.rs b/stacker/src/memory_arena.rs index 6f3f2f494..6348da670 100644 --- a/stacker/src/memory_arena.rs +++ b/stacker/src/memory_arena.rs @@ -89,7 +89,6 @@ pub fn load(data: &[u8]) -> Item { } /// The `MemoryArena` -#[allow(clippy::new_without_default)] pub struct MemoryArena { pages: Vec, } diff --git a/stacker/src/shared_arena_hashmap.rs b/stacker/src/shared_arena_hashmap.rs index 0e50315d4..f558b0f8a 100644 --- a/stacker/src/shared_arena_hashmap.rs +++ b/stacker/src/shared_arena_hashmap.rs @@ -169,7 +169,7 @@ impl SharedArenaHashMap { } #[inline] - fn get_key_value<'a>(&'a self, addr: Addr, memory_arena: &'a MemoryArena) -> (&[u8], Addr) { + fn get_key_value<'a>(&'a self, addr: Addr, memory_arena: &'a MemoryArena) -> (&'a [u8], Addr) { let data = memory_arena.slice_from(addr); let key_bytes_len_bytes = unsafe { data.get_unchecked(..2) }; let key_bytes_len = u16::from_le_bytes(key_bytes_len_bytes.try_into().unwrap()); @@ -233,7 +233,7 @@ impl SharedArenaHashMap { } #[inline] - pub fn iter<'a>(&'a self, memory_arena: &'a MemoryArena) -> Iter<'_> { + pub fn iter<'a>(&'a self, memory_arena: &'a MemoryArena) -> Iter<'a> { Iter { inner: self .table