mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 13:24:27 +01:00
Fix clippy errors
This commit is contained in:
parent
b09676779d
commit
abf1cf9cd5
@ -225,7 +225,7 @@ fn bytes_to_highlight(source: &str, target: &str) -> usize {
|
|||||||
for (col, char_t) in target.chars().enumerate() {
|
for (col, char_t) in target.chars().enumerate() {
|
||||||
let col = col + 1;
|
let col = col + 1;
|
||||||
let last_match_row = *last_row.get(&char_t).unwrap_or(&0);
|
let last_match_row = *last_row.get(&char_t).unwrap_or(&0);
|
||||||
let cost = if char_s == char_t { 0 } else { 1 };
|
let cost = usize::from(char_s != char_t);
|
||||||
|
|
||||||
let dist_add = matrix[(row, col + 1)] + 1;
|
let dist_add = matrix[(row, col + 1)] + 1;
|
||||||
let dist_del = matrix[(row + 1, col)] + 1;
|
let dist_del = matrix[(row + 1, col)] + 1;
|
||||||
|
@ -329,7 +329,7 @@ impl FacetsUpdateIncrementalInner {
|
|||||||
|
|
||||||
let key =
|
let key =
|
||||||
FacetGroupKey { field_id, level, left_bound: insertion_key.left_bound.clone() };
|
FacetGroupKey { field_id, level, left_bound: insertion_key.left_bound.clone() };
|
||||||
let value = FacetGroupValue { size: size_left as u8, bitmap: values_left };
|
let value = FacetGroupValue { size: size_left, bitmap: values_left };
|
||||||
(key, value)
|
(key, value)
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -345,7 +345,7 @@ impl FacetsUpdateIncrementalInner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let key = FacetGroupKey { field_id, level, left_bound: right_left_bound.to_vec() };
|
let key = FacetGroupKey { field_id, level, left_bound: right_left_bound.to_vec() };
|
||||||
let value = FacetGroupValue { size: size_right as u8, bitmap: values_right };
|
let value = FacetGroupValue { size: size_right, bitmap: values_right };
|
||||||
(key, value)
|
(key, value)
|
||||||
};
|
};
|
||||||
drop(iter);
|
drop(iter);
|
||||||
@ -373,8 +373,7 @@ impl FacetsUpdateIncrementalInner {
|
|||||||
|
|
||||||
let highest_level = get_highest_level(txn, self.db, field_id)?;
|
let highest_level = get_highest_level(txn, self.db, field_id)?;
|
||||||
|
|
||||||
let result =
|
let result = self.insert_in_level(txn, field_id, highest_level, facet_value, docids)?;
|
||||||
self.insert_in_level(txn, field_id, highest_level as u8, facet_value, docids)?;
|
|
||||||
match result {
|
match result {
|
||||||
InsertionResult::InPlace => return Ok(()),
|
InsertionResult::InPlace => return Ok(()),
|
||||||
InsertionResult::Expand => return Ok(()),
|
InsertionResult::Expand => return Ok(()),
|
||||||
@ -425,7 +424,7 @@ impl FacetsUpdateIncrementalInner {
|
|||||||
level: highest_level + 1,
|
level: highest_level + 1,
|
||||||
left_bound: first_key.unwrap().left_bound,
|
left_bound: first_key.unwrap().left_bound,
|
||||||
};
|
};
|
||||||
let value = FacetGroupValue { size: group_size as u8, bitmap: values };
|
let value = FacetGroupValue { size: group_size, bitmap: values };
|
||||||
to_add.push((key.into_owned(), value));
|
to_add.push((key.into_owned(), value));
|
||||||
}
|
}
|
||||||
// now we add the rest of the level, in case its size is > group_size * min_level_size
|
// now we add the rest of the level, in case its size is > group_size * min_level_size
|
||||||
@ -584,8 +583,7 @@ impl FacetsUpdateIncrementalInner {
|
|||||||
}
|
}
|
||||||
let highest_level = get_highest_level(txn, self.db, field_id)?;
|
let highest_level = get_highest_level(txn, self.db, field_id)?;
|
||||||
|
|
||||||
let result =
|
let result = self.delete_in_level(txn, field_id, highest_level, facet_value, docids)?;
|
||||||
self.delete_in_level(txn, field_id, highest_level as u8, facet_value, docids)?;
|
|
||||||
match result {
|
match result {
|
||||||
DeletionResult::InPlace => return Ok(()),
|
DeletionResult::InPlace => return Ok(()),
|
||||||
DeletionResult::Reduce { .. } => return Ok(()),
|
DeletionResult::Reduce { .. } => return Ok(()),
|
||||||
|
@ -36,7 +36,7 @@ impl<'t, 'u, 'i> WordsPrefixesFst<'t, 'u, 'i> {
|
|||||||
/// Default value is `4` bytes. This value must be between 1 and 25 will be clamped
|
/// Default value is `4` bytes. This value must be between 1 and 25 will be clamped
|
||||||
/// to these bounds, otherwise.
|
/// to these bounds, otherwise.
|
||||||
pub fn max_prefix_length(&mut self, value: usize) -> &mut Self {
|
pub fn max_prefix_length(&mut self, value: usize) -> &mut Self {
|
||||||
self.max_prefix_length = value.min(25).max(1); // clamp [1, 25]
|
self.max_prefix_length = value.clamp(1, 25);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user