From f3fc2bd01fadfab8fcfc5c8b7d0802e235fa2781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Wed, 13 Mar 2024 15:22:14 +0100 Subject: [PATCH] Address some issues with preallocations --- milli/src/search/facet/search.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/milli/src/search/facet/search.rs b/milli/src/search/facet/search.rs index a917bcf7c..0251d6b8d 100644 --- a/milli/src/search/facet/search.rs +++ b/milli/src/search/facet/search.rs @@ -89,7 +89,7 @@ impl<'a> SearchForFacetValues<'a> { let fst = match self.search_query.index.facet_id_string_fst.get(rtxn, &fid)? { Some(fst) => fst, - None => return Ok(vec![]), + None => return Ok(Vec::new()), }; let search_candidates = self @@ -274,11 +274,11 @@ enum ValuesCollection { impl ValuesCollection { pub fn by_lexicographic(max: usize) -> Self { - ValuesCollection::Lexicographic { max, content: Vec::with_capacity(max) } + ValuesCollection::Lexicographic { max, content: Vec::new() } } pub fn by_count(max: usize) -> Self { - ValuesCollection::Count { max, content: BinaryHeap::with_capacity(max) } + ValuesCollection::Count { max, content: BinaryHeap::new() } } pub fn insert(&mut self, value: FacetValueHit) -> ControlFlow<()> {