Avoid cloning FilterCondition in filter array parsing

This commit is contained in:
Loïc Lecrenier 2022-08-18 13:06:57 +02:00
parent 8a271223a9
commit 9b6602cba2

View File

@ -104,7 +104,7 @@ impl<'a> Filter<'a> {
if ors.len() > 1 { if ors.len() > 1 {
ands.push(FilterCondition::Or(ors)); ands.push(FilterCondition::Or(ors));
} else if ors.len() == 1 { } else if ors.len() == 1 {
ands.push(ors[0].clone()); ands.push(ors.pop().unwrap());
} }
} }
Either::Right(rule) => { Either::Right(rule) => {
@ -117,7 +117,7 @@ impl<'a> Filter<'a> {
let and = if ands.is_empty() { let and = if ands.is_empty() {
return Ok(None); return Ok(None);
} else if ands.len() == 1 { } else if ands.len() == 1 {
ands[0].clone() ands.pop().unwrap()
} else { } else {
FilterCondition::And(ands) FilterCondition::And(ands)
}; };