From fe5d50969a9aa56f1a5f115179438f4b474f357d Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Wed, 20 Nov 2024 12:44:46 +0100 Subject: [PATCH] Fix filed selector in extrators --- crates/milli/src/update/new/extract/mod.rs | 23 ++++++++++------------ 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/crates/milli/src/update/new/extract/mod.rs b/crates/milli/src/update/new/extract/mod.rs index 0e4f19daf..e67f70db1 100644 --- a/crates/milli/src/update/new/extract/mod.rs +++ b/crates/milli/src/update/new/extract/mod.rs @@ -174,19 +174,16 @@ pub mod perm_json_p { }) { Selection::Skip } else if let Some(selectors) = selectors { - selectors - .iter() - .filter_map(|selector| { - if contained_in(field_name, selector) { - Some(Selection::Select) - } else if contained_in(selector, field_name) { - Some(Selection::Parent) - } else { - None - } - }) - .next() - .unwrap_or(Selection::Skip) + let mut selection = Selection::Skip; + for selector in selectors { + if contained_in(field_name, selector) { + selection = Selection::Select; + break; + } else if contained_in(selector, field_name) { + selection = Selection::Parent; + } + } + selection } else { Selection::Select }