mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 04:25:06 +08:00
remove unnecessary clone
This commit is contained in:
parent
c95d4e48a5
commit
ce789682cc
@ -214,7 +214,7 @@ impl<'a> SearchBuilder<'a> {
|
|||||||
// Transform to readable matches
|
// Transform to readable matches
|
||||||
if let Some(attributes_to_highlight) = &self.attributes_to_highlight {
|
if let Some(attributes_to_highlight) = &self.attributes_to_highlight {
|
||||||
let matches = calculate_matches(
|
let matches = calculate_matches(
|
||||||
matches.clone(),
|
&matches,
|
||||||
self.attributes_to_highlight.clone(),
|
self.attributes_to_highlight.clone(),
|
||||||
&schema,
|
&schema,
|
||||||
);
|
);
|
||||||
@ -222,7 +222,7 @@ impl<'a> SearchBuilder<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let matches_info = if self.matches {
|
let matches_info = if self.matches {
|
||||||
Some(calculate_matches(matches, self.attributes_to_retrieve.clone(), &schema))
|
Some(calculate_matches(&matches, self.attributes_to_retrieve.clone(), &schema))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
@ -417,7 +417,7 @@ fn crop_document(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn calculate_matches(
|
fn calculate_matches(
|
||||||
matches: Vec<Highlight>,
|
matches: &[Highlight],
|
||||||
attributes_to_retrieve: Option<HashSet<String>>,
|
attributes_to_retrieve: Option<HashSet<String>>,
|
||||||
schema: &Schema,
|
schema: &Schema,
|
||||||
) -> MatchesInfos {
|
) -> MatchesInfos {
|
||||||
@ -544,7 +544,7 @@ mod tests {
|
|||||||
|
|
||||||
let schema = Schema::with_primary_key("title");
|
let schema = Schema::with_primary_key("title");
|
||||||
|
|
||||||
let matches_result = super::calculate_matches(matches, Some(attributes_to_retrieve), &schema);
|
let matches_result = super::calculate_matches(&matches, Some(attributes_to_retrieve), &schema);
|
||||||
|
|
||||||
let mut matches_result_expected: HashMap<String, Vec<MatchPosition>> = HashMap::new();
|
let mut matches_result_expected: HashMap<String, Vec<MatchPosition>> = HashMap::new();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user