mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 02:27:40 +08:00
Fix clippy errors
This commit is contained in:
parent
37d4551e8e
commit
3092cf0448
@ -100,6 +100,8 @@ pub async fn list_indexes(
|
||||
Ok(Some(IndexView::new(uid.to_string(), index)?))
|
||||
})?;
|
||||
// Won't cause to open all indexes because IndexView doesn't keep the `Index` opened.
|
||||
// error when trying to fix it: the trait `ExactSizeIterator` is not implemented for `Flatten<IntoIter<Option<IndexView>>>`
|
||||
#[allow(clippy::needless_collect)]
|
||||
let indexes: Vec<IndexView> = indexes.into_iter().flatten().collect();
|
||||
let ret = paginate.as_pagination().auto_paginate_sized(indexes.into_iter());
|
||||
|
||||
|
@ -127,6 +127,7 @@ pub fn extract_docid_word_positions<R: io::Read + io::Seek>(
|
||||
.map(|reader| (documents_ids, reader, script_language_docids))
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn extract_tokens_from_document<T: AsRef<[u8]>>(
|
||||
obkv: &KvReader<FieldId>,
|
||||
searchable_fields: &Option<HashSet<FieldId>>,
|
||||
@ -272,23 +273,20 @@ fn most_frequent_languages(
|
||||
if languages_frequency.len() > 1 {
|
||||
let threshold = compute_laguage_frequency_threshold(languages_frequency);
|
||||
|
||||
let languages: Vec<_> = languages_frequency
|
||||
.iter()
|
||||
.filter(|(_, c)| *c > threshold)
|
||||
.map(|(l, _)| l.clone())
|
||||
.collect();
|
||||
let languages: Vec<_> =
|
||||
languages_frequency.iter().filter(|(_, c)| *c > threshold).map(|(l, _)| *l).collect();
|
||||
|
||||
if languages.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some((script.clone(), languages))
|
||||
Some((*script, languages))
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn compute_laguage_frequency_threshold(languages_frequency: &Vec<(Language, usize)>) -> usize {
|
||||
fn compute_laguage_frequency_threshold(languages_frequency: &[(Language, usize)]) -> usize {
|
||||
let total: usize = languages_frequency.iter().map(|(_, c)| c).sum();
|
||||
total / 20 // 5% is a completely arbitrar value.
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user