mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 03:55:07 +08:00
make clippy happy
This commit is contained in:
parent
caa6a7149a
commit
9fffb8e83d
@ -272,9 +272,9 @@ pub fn swap_index_uid_in_task(task: &mut Task, swap: (&str, &str)) {
|
||||
}
|
||||
for index_uid in index_uids {
|
||||
if index_uid == swap.0 {
|
||||
*index_uid = swap.1.to_owned();
|
||||
swap.1.clone_into(index_uid);
|
||||
} else if index_uid == swap.1 {
|
||||
*index_uid = swap.0.to_owned();
|
||||
swap.0.clone_into(index_uid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -730,7 +730,7 @@ pub fn perform_search(
|
||||
let mut ids = BTreeSet::new();
|
||||
for attr in attrs {
|
||||
if attr == "*" {
|
||||
ids = displayed_ids.clone();
|
||||
ids.clone_from(&displayed_ids);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ impl FieldidsWeightsMap {
|
||||
self.map.values().copied().max()
|
||||
}
|
||||
|
||||
pub fn ids<'a>(&'a self) -> impl Iterator<Item = FieldId> + 'a {
|
||||
pub fn ids(&self) -> impl Iterator<Item = FieldId> + '_ {
|
||||
self.map.keys().copied()
|
||||
}
|
||||
}
|
||||
|
@ -632,7 +632,7 @@ impl Index {
|
||||
// Special case if there is no user defined fields.
|
||||
// Then the whole field id map is marked as searchable.
|
||||
if user_fields.is_none() {
|
||||
let mut weights = self.fieldids_weights_map(&wtxn)?;
|
||||
let mut weights = self.fieldids_weights_map(wtxn)?;
|
||||
let mut searchable = Vec::new();
|
||||
for (weight, (fid, name)) in fields_ids_map.iter().enumerate() {
|
||||
searchable.push(name);
|
||||
@ -648,7 +648,7 @@ impl Index {
|
||||
// We can write the user defined searchable fields as-is.
|
||||
self.put_user_defined_searchable_fields(wtxn, user_fields)?;
|
||||
|
||||
let mut weights = self.fieldids_weights_map(&wtxn)?;
|
||||
let mut weights = self.fieldids_weights_map(wtxn)?;
|
||||
|
||||
// Now we generate the real searchable fields:
|
||||
// 1. Take the user defined searchable fields as-is to keep the priority defined by the attributes criterion.
|
||||
@ -666,7 +666,7 @@ impl Index {
|
||||
|
||||
let weight: u16 =
|
||||
weight.try_into().map_err(|_| UserError::AttributeLimitReached)?;
|
||||
weights.insert(id, weight as u16);
|
||||
weights.insert(id, weight);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -701,7 +701,7 @@ impl Index {
|
||||
self.main
|
||||
.remap_types::<Str, SerdeBincode<Vec<&'t str>>>()
|
||||
.get(rtxn, main_key::SEARCHABLE_FIELDS_KEY)?
|
||||
.map(|fields| Ok(fields.into_iter().map(|field| Cow::Borrowed(field)).collect()))
|
||||
.map(|fields| Ok(fields.into_iter().map(Cow::Borrowed).collect()))
|
||||
.unwrap_or_else(|| {
|
||||
Ok(self
|
||||
.fields_ids_map(rtxn)?
|
||||
|
@ -101,7 +101,7 @@ pub fn bucket_sort<'ctx, Q: RankingRuleQueryTrait>(
|
||||
|
||||
let mut ranking_rule_universes: Vec<RoaringBitmap> =
|
||||
vec![RoaringBitmap::default(); ranking_rules_len];
|
||||
ranking_rule_universes[0] = universe.clone();
|
||||
ranking_rule_universes[0].clone_from(universe);
|
||||
let mut cur_ranking_rule_index = 0;
|
||||
|
||||
/// Finish iterating over the current ranking rule, yielding
|
||||
@ -232,7 +232,7 @@ pub fn bucket_sort<'ctx, Q: RankingRuleQueryTrait>(
|
||||
}
|
||||
|
||||
cur_ranking_rule_index += 1;
|
||||
ranking_rule_universes[cur_ranking_rule_index] = next_bucket.candidates.clone();
|
||||
ranking_rule_universes[cur_ranking_rule_index].clone_from(&next_bucket.candidates);
|
||||
logger.start_iteration_ranking_rule(
|
||||
cur_ranking_rule_index,
|
||||
ranking_rules[cur_ranking_rule_index].as_ref(),
|
||||
|
@ -178,8 +178,7 @@ pub struct SearchableFids {
|
||||
|
||||
impl SearchableFids {
|
||||
pub fn contains(&self, fid: &FieldId) -> bool {
|
||||
self.tolerant.iter().find(|(id, _)| id == fid).is_some()
|
||||
|| self.exact.iter().find(|(id, _)| id == fid).is_some()
|
||||
self.tolerant.iter().any(|(id, _)| id == fid) || self.exact.iter().any(|(id, _)| id == fid)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user