From 9b6602cba2edd365ca1afa8786f8ce723f9f873d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Thu, 18 Aug 2022 13:06:57 +0200 Subject: [PATCH] Avoid cloning FilterCondition in filter array parsing --- milli/src/search/facet/filter.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/milli/src/search/facet/filter.rs b/milli/src/search/facet/filter.rs index 2f6fb5b00..7241dab2b 100644 --- a/milli/src/search/facet/filter.rs +++ b/milli/src/search/facet/filter.rs @@ -104,7 +104,7 @@ impl<'a> Filter<'a> { if ors.len() > 1 { ands.push(FilterCondition::Or(ors)); } else if ors.len() == 1 { - ands.push(ors[0].clone()); + ands.push(ors.pop().unwrap()); } } Either::Right(rule) => { @@ -117,7 +117,7 @@ impl<'a> Filter<'a> { let and = if ands.is_empty() { return Ok(None); } else if ands.len() == 1 { - ands[0].clone() + ands.pop().unwrap() } else { FilterCondition::And(ands) };