From ebb48ca1446a82360b383054fb055e7c47d4506c Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 17:37:12 +0000 Subject: [PATCH] fix(fig): collapse shape adapter lookup conditions --- crates/format/src/fig/map.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/crates/format/src/fig/map.rs b/crates/format/src/fig/map.rs index 50cbf24fa..f075c1526 100644 --- a/crates/format/src/fig/map.rs +++ b/crates/format/src/fig/map.rs @@ -120,12 +120,11 @@ fn native_board_shapes(msg: &Kv, json: &mut Value, warnings: &mut Vec) { /// origin at most once. The origin index avoids rescanning the tree for every source record. fn apply_native_board_shapes(json: &mut Value, shapes: &std::collections::HashMap) { fn visit(json: &mut Value, shapes: &std::collections::HashMap, visited: &mut std::collections::HashSet) { - if let Some(origin) = json.get(craft_fig::rest::FIG_SOURCE_FIELD).and_then(|s| s.get("origin")).and_then(Value::as_str).map(str::to_owned) { - if visited.insert(origin.clone()) { - if let Some((shape, empty_body)) = shapes.get(&origin).copied() { - apply_native_board_shape(json, &origin, shape, empty_body); - } - } + if let Some(origin) = json.get(craft_fig::rest::FIG_SOURCE_FIELD).and_then(|s| s.get("origin")).and_then(Value::as_str).map(str::to_owned) + && visited.insert(origin.clone()) + && let Some((shape, empty_body)) = shapes.get(&origin).copied() + { + apply_native_board_shape(json, &origin, shape, empty_body); } match json { Value::Object(fields) => fields.values_mut().for_each(|child| visit(child, shapes, visited)),