From 59ddfa84ecfa3f5bd84cb9e3643184e05903b4ad Mon Sep 17 00:00:00 2001 From: shuiyisong Date: Wed, 26 Nov 2025 18:35:21 +0800 Subject: [PATCH] fix: check and clippy Signed-off-by: shuiyisong --- src/index/src/inverted_index/format/reader.rs | 6 ++---- src/index/src/inverted_index/format/reader/footer.rs | 4 ++-- .../src/inverted_index/search/fst_values_mapper.rs | 10 +++------- .../search/index_apply/predicates_apply.rs | 4 +--- src/mito2/src/sst/index/fulltext_index/applier.rs | 12 ++++-------- 5 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/index/src/inverted_index/format/reader.rs b/src/index/src/inverted_index/format/reader.rs index eb78afbfe1..76425f6ad1 100644 --- a/src/index/src/inverted_index/format/reader.rs +++ b/src/index/src/inverted_index/format/reader.rs @@ -112,8 +112,7 @@ pub trait InvertedIndexReader: Send + Sync { ranges: &[Range], metrics: Option<&'a mut InvertedIndexReadMetrics>, ) -> Result> { - let mut metrics = metrics; - self.read_vec(ranges, metrics.as_deref_mut()) + self.read_vec(ranges, metrics) .await? .into_iter() .map(|bytes| FstMap::new(bytes.to_vec()).context(DecodeFstSnafu)) @@ -141,9 +140,8 @@ pub trait InvertedIndexReader: Send + Sync { ranges: &[(Range, BitmapType)], metrics: Option<&'a mut InvertedIndexReadMetrics>, ) -> Result> { - let mut metrics = metrics; let (ranges, types): (Vec<_>, Vec<_>) = ranges.iter().cloned().unzip(); - let bytes = self.read_vec(&ranges, metrics.as_deref_mut()).await?; + let bytes = self.read_vec(&ranges, metrics).await?; bytes .into_iter() .zip(types) diff --git a/src/index/src/inverted_index/format/reader/footer.rs b/src/index/src/inverted_index/format/reader/footer.rs index 3758b55e21..866021c6e6 100644 --- a/src/index/src/inverted_index/format/reader/footer.rs +++ b/src/index/src/inverted_index/format/reader/footer.rs @@ -57,9 +57,9 @@ impl InvertedIndexFooterReader { } impl InvertedIndexFooterReader { - pub async fn metadata<'a>( + pub async fn metadata( &mut self, - mut metrics: Option<&'a mut InvertedIndexReadMetrics>, + mut metrics: Option<&mut InvertedIndexReadMetrics>, ) -> Result { ensure!( self.blob_size >= FOOTER_PAYLOAD_SIZE_SIZE, diff --git a/src/index/src/inverted_index/search/fst_values_mapper.rs b/src/index/src/inverted_index/search/fst_values_mapper.rs index 91078623cb..38df713c8d 100644 --- a/src/index/src/inverted_index/search/fst_values_mapper.rs +++ b/src/index/src/inverted_index/search/fst_values_mapper.rs @@ -33,12 +33,11 @@ impl<'a> ParallelFstValuesMapper<'a> { Self { reader } } - pub async fn map_values_vec<'b>( + pub async fn map_values_vec( &mut self, - value_and_meta_vec: &[(Vec, &'b InvertedIndexMeta)], + value_and_meta_vec: &[(Vec, &InvertedIndexMeta)], metrics: Option<&mut InvertedIndexReadMetrics>, ) -> Result> { - let mut metrics = metrics; let groups = value_and_meta_vec .iter() .map(|(values, _)| values.len()) @@ -66,10 +65,7 @@ impl<'a> ParallelFstValuesMapper<'a> { } common_telemetry::debug!("fetch ranges: {:?}", fetch_ranges); - let mut bitmaps = self - .reader - .bitmap_deque(&fetch_ranges, metrics.as_deref_mut()) - .await?; + let mut bitmaps = self.reader.bitmap_deque(&fetch_ranges, metrics).await?; let mut output = Vec::with_capacity(groups.len()); for counter in groups { diff --git a/src/index/src/inverted_index/search/index_apply/predicates_apply.rs b/src/index/src/inverted_index/search/index_apply/predicates_apply.rs index 99a3a1ebb0..441a4b4304 100644 --- a/src/index/src/inverted_index/search/index_apply/predicates_apply.rs +++ b/src/index/src/inverted_index/search/index_apply/predicates_apply.rs @@ -94,9 +94,7 @@ impl IndexApplier for PredicatesIndexApplier { .collect::>(); let mut mapper = ParallelFstValuesMapper::new(reader); - let mut bm_vec = mapper - .map_values_vec(&value_and_meta_vec, metrics.as_deref_mut()) - .await?; + let mut bm_vec = mapper.map_values_vec(&value_and_meta_vec, metrics).await?; let mut bitmap = bm_vec.pop().unwrap(); // SAFETY: `fst_ranges` is not empty for bm in bm_vec { diff --git a/src/mito2/src/sst/index/fulltext_index/applier.rs b/src/mito2/src/sst/index/fulltext_index/applier.rs index 8c1f9ec3bc..15818257dd 100644 --- a/src/mito2/src/sst/index/fulltext_index/applier.rs +++ b/src/mito2/src/sst/index/fulltext_index/applier.rs @@ -615,10 +615,8 @@ impl IndexSource { let (reader, fallbacked) = self.ensure_reader(file_id, file_size_hint).await?; // Track cache miss if fallbacked to remote - if fallbacked { - if let Some(m) = metrics { - m.blob_cache_miss += 1; - } + if fallbacked && let Some(m) = metrics { + m.blob_cache_miss += 1; } let res = reader.blob(key).await; @@ -655,10 +653,8 @@ impl IndexSource { let (reader, fallbacked) = self.ensure_reader(file_id, file_size_hint).await?; // Track cache miss if fallbacked to remote - if fallbacked { - if let Some(m) = &mut metrics { - m.blob_cache_miss += 1; - } + if fallbacked && let Some(m) = &mut metrics { + m.blob_cache_miss += 1; } let start = metrics.as_ref().map(|_| Instant::now());