diff --git a/plugin/src/Reconciler/matching.lua b/plugin/src/Reconciler/matching.lua index bb5cd58c..2a703dee 100644 --- a/plugin/src/Reconciler/matching.lua +++ b/plugin/src/Reconciler/matching.lua @@ -301,9 +301,7 @@ function Matching._computeChildrenCost( local cost = 0 for _, pair in childResult.matched do - cost += Matching._computeChangeCount( - pair.virtualId, pair.studioInstance, virtualInstances, bestSoFar - cost - ) + cost += Matching._computeChangeCount(pair.virtualId, pair.studioInstance, virtualInstances, bestSoFar - cost) if cost >= bestSoFar then return cost end @@ -527,9 +525,7 @@ function Matching.matchChildren( local sCaches: { [number]: any } = {} for _, si in sIndices do if not matchedS2[si] then - sCaches[si] = Matching._cacheStudio( - remainingStudio[si], classKeys, extraPropNamesArray - ) + sCaches[si] = Matching._cacheStudio(remainingStudio[si], classKeys, extraPropNamesArray) end end @@ -569,9 +565,7 @@ function Matching.matchChildren( -- Recursive children cost local vInst = virtualInstances[remainingVirtual[vi]] if vInst then - cost += Matching._computeChildrenCost( - vInst, sCache, virtualInstances, bestSoFar - cost - ) + cost += Matching._computeChildrenCost(vInst, sCache, virtualInstances, bestSoFar - cost) end end diff --git a/src/snapshot/matching.rs b/src/snapshot/matching.rs index 42f36918..226eeb7f 100644 --- a/src/snapshot/matching.rs +++ b/src/snapshot/matching.rs @@ -772,7 +772,10 @@ mod tests { use rbx_dom_weak::types::Variant; let db = rbx_reflection_database::get().expect("reflection database should load"); - let texture = db.classes.get("Texture").expect("Texture class should exist"); + let texture = db + .classes + .get("Texture") + .expect("Texture class should exist"); let face_default = texture .default_properties .get("Face") @@ -842,15 +845,11 @@ mod tests { make_snapshot_with_props("Texture", "Texture", props) }) .collect(); - tree_children.push(make_snapshot_with_props( - "Texture", - "Texture", - { - let mut props = shared_props.clone(); - props.push(("Face", Variant::Enum(face_front.clone()))); - props - }, - )); + tree_children.push(make_snapshot_with_props("Texture", "Texture", { + let mut props = shared_props.clone(); + props.push(("Face", Variant::Enum(face_front.clone()))); + props + })); let (tree, tree_refs) = make_tree_from_snapshots(tree_children); let result = match_forward(snaps, &tree_refs, &tree); @@ -1103,13 +1102,13 @@ mod tests { Some(Enum::from_u32(1)), // Top Some(Enum::from_u32(0)), // Right Some(Enum::from_u32(3)), // Left - None, // Front (default, omitted) + None, // Front (default, omitted) Some(Enum::from_u32(4)), // Bottom ]; let faces_group_b = [ Some(Enum::from_u32(2)), // Back Some(Enum::from_u32(4)), // Bottom - None, // Front (default, omitted) + None, // Front (default, omitted) Some(Enum::from_u32(1)), // Top Some(Enum::from_u32(3)), // Left ]; @@ -1132,11 +1131,7 @@ mod tests { } snaps.push(make_snapshot_with_props("Texture", "Texture", snap_props)); - tree_children.push(make_snapshot_with_props( - "Texture", - "Texture", - tree_props, - )); + tree_children.push(make_snapshot_with_props("Texture", "Texture", tree_props)); } } diff --git a/tests/tests/matching_fixtures.rs b/tests/tests/matching_fixtures.rs index f44dc593..b5c6f7de 100644 --- a/tests/tests/matching_fixtures.rs +++ b/tests/tests/matching_fixtures.rs @@ -26,7 +26,8 @@ fn load_input_rbxm() -> WeakDom { let path = Path::new(SYNCBACK_TESTS_PATH) .join(FIXTURE_DIR) .join("input.rbxm"); - let data = std::fs::read(&path).unwrap_or_else(|e| panic!("Failed to read {}: {}", path.display(), e)); + let data = + std::fs::read(&path).unwrap_or_else(|e| panic!("Failed to read {}: {}", path.display(), e)); rbx_binary::from_reader(data.as_slice()) .unwrap_or_else(|e| panic!("Failed to parse {}: {}", path.display(), e)) } @@ -69,12 +70,13 @@ fn rojo_tree_to_weak_dom(tree: &librojo::RojoTree) -> WeakDom { } // Recursively copy children - fn copy_children(tree: &librojo::RojoTree, parent_ref: Ref, dom: &mut WeakDom, dom_parent: Ref) { - let children: Vec = tree - .get_instance(parent_ref) - .unwrap() - .children() - .to_vec(); + fn copy_children( + tree: &librojo::RojoTree, + parent_ref: Ref, + dom: &mut WeakDom, + dom_parent: Ref, + ) { + let children: Vec = tree.get_instance(parent_ref).unwrap().children().to_vec(); for child_ref in children { let child = tree.get_instance(child_ref).unwrap(); let builder = rbx_dom_weak::InstanceBuilder::new(child.class_name().as_str()) @@ -224,7 +226,8 @@ fn syncback_matching_ufowave_textures() { let effective_old_face = old_face.or(Some(5)); assert_eq!( - new_face, effective_old_face, + new_face, + effective_old_face, "Face mismatch: input {:?} (name={}) matched to expected {:?} (name={})", new_face, input_dom.get_by_ref(*new_ref).unwrap().name, @@ -303,8 +306,7 @@ fn forward_matching_ufowave_textures() { assert!(!snap_textures.is_empty(), "No Texture children found"); // Run forward sync matching - let result = - librojo::snapshot::matching::match_forward(snap_textures, &tree_textures, &tree); + let result = librojo::snapshot::matching::match_forward(snap_textures, &tree_textures, &tree); assert_eq!( result.matched.len(), @@ -344,10 +346,7 @@ fn forward_matching_ufowave_textures() { // Both omitted: both at default, fine } (Some(sv), None) => { - panic!( - "Snap has Face={:?} but tree has none", - sv - ); + panic!("Snap has Face={:?} but tree has none", sv); } } }