remove useless lifetime on Distinct Trait

This commit is contained in:
Marin Postma 2021-06-01 14:43:48 +02:00 committed by Kerollmops
parent 187c713de5
commit 1e366dae3e
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4
4 changed files with 8 additions and 7 deletions

View File

@ -172,7 +172,7 @@ impl DocIter for FacetDistinctIter<'_> {
} }
} }
impl<'a> Distinct<'_> for FacetDistinct<'a> { impl<'a> Distinct for FacetDistinct<'a> {
type Iter = FacetDistinctIter<'a>; type Iter = FacetDistinctIter<'a>;
fn distinct(&mut self, candidates: RoaringBitmap, excluded: RoaringBitmap) -> Self::Iter { fn distinct(&mut self, candidates: RoaringBitmap, excluded: RoaringBitmap) -> Self::Iter {

View File

@ -18,10 +18,10 @@ pub trait DocIter: Iterator<Item = anyhow::Result<DocumentId>> {
/// must return an iterator containing only distinct documents, and add the discarded documents to /// must return an iterator containing only distinct documents, and add the discarded documents to
/// the excluded set. The excluded set can later be retrieved by calling `DocIter::excluded` on the /// the excluded set. The excluded set can later be retrieved by calling `DocIter::excluded` on the
/// returned iterator. /// returned iterator.
pub trait Distinct<'a> { pub trait Distinct {
type Iter: DocIter; type Iter: DocIter;
fn distinct(&'a mut self, candidates: RoaringBitmap, excluded: RoaringBitmap) -> Self::Iter; fn distinct(&mut self, candidates: RoaringBitmap, excluded: RoaringBitmap) -> Self::Iter;
} }
#[cfg(test)] #[cfg(test)]

View File

@ -26,7 +26,7 @@ impl DocIter for NoopDistinctIter {
} }
} }
impl Distinct<'_> for NoopDistinct { impl Distinct for NoopDistinct {
type Iter = NoopDistinctIter; type Iter = NoopDistinctIter;
fn distinct(&mut self, candidates: RoaringBitmap, excluded: RoaringBitmap) -> Self::Iter { fn distinct(&mut self, candidates: RoaringBitmap, excluded: RoaringBitmap) -> Self::Iter {

View File

@ -147,12 +147,13 @@ impl<'a> Search<'a> {
} }
} }
fn perform_sort( fn perform_sort<D: Distinct>(
&self, &self,
mut distinct: impl for<'c> Distinct<'c>, mut distinct: D,
matching_words: MatchingWords, matching_words: MatchingWords,
mut criteria: Final, mut criteria: Final,
) -> anyhow::Result<SearchResult> { ) -> anyhow::Result<SearchResult>
{
let mut offset = self.offset; let mut offset = self.offset;
let mut initial_candidates = RoaringBitmap::new(); let mut initial_candidates = RoaringBitmap::new();
let mut excluded_candidates = RoaringBitmap::new(); let mut excluded_candidates = RoaringBitmap::new();