From d6169c6d84aaf1aa6a764c07f4b59eb7e7364fff Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 18 Feb 2026 03:32:38 -0600 Subject: [PATCH] Refactor test assertions and improve code formatting - Simplified test assertions in `fs_snapshot.rs` and `ref_properties.rs` for better readability by removing unnecessary line breaks. - Enhanced the formatting of code in `rojo_ref.rs` to maintain consistency and improve clarity. These changes improve the overall readability and maintainability of the test code and related implementations. --- src/rojo_ref.rs | 4 +--- src/syncback/fs_snapshot.rs | 4 +--- src/syncback/ref_properties.rs | 16 +++++++++------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/rojo_ref.rs b/src/rojo_ref.rs index 4ea70326..35b50bad 100644 --- a/src/rojo_ref.rs +++ b/src/rojo_ref.rs @@ -329,9 +329,7 @@ impl RefPathIndex { continue; } if let Ok(bytes) = std::fs::read(&path) { - if let Ok(val) = - crate::json::from_slice::(&bytes) - { + if let Ok(val) = crate::json::from_slice::(&bytes) { if let Some(attrs) = val.get("attributes").and_then(|a| a.as_object()) { for (key, value) in attrs { if key.starts_with(crate::REF_PATH_ATTRIBUTE_PREFIX) { diff --git a/src/syncback/fs_snapshot.rs b/src/syncback/fs_snapshot.rs index 00fe2e3a..451d13d3 100644 --- a/src/syncback/fs_snapshot.rs +++ b/src/syncback/fs_snapshot.rs @@ -744,9 +744,7 @@ mod tests { "Attachment1 wrong. Got:\n{result}" ); assert!( - result.contains( - r#""Rojo_Ref_PrimaryPart": "Workspace/Model/Handle.model.json5""# - ), + result.contains(r#""Rojo_Ref_PrimaryPart": "Workspace/Model/Handle.model.json5""#), "PrimaryPart wrong. Got:\n{result}" ); } diff --git a/src/syncback/ref_properties.rs b/src/syncback/ref_properties.rs index 1ef83f91..a3a09a2d 100644 --- a/src/syncback/ref_properties.rs +++ b/src/syncback/ref_properties.rs @@ -435,8 +435,10 @@ mod tests { let mut attachments = Vec::new(); for _ in 0..4 { - let att = - dom.insert(container, InstanceBuilder::new("Attachment").with_name("001")); + let att = dom.insert( + container, + InstanceBuilder::new("Attachment").with_name("001"), + ); attachments.push(att); } @@ -489,12 +491,12 @@ mod tests { let links = collect_referents(&dom2, &HashMap::new(), None); - let placeholders: Vec<&String> = links - .placeholder_to_target - .keys() - .collect(); + let placeholders: Vec<&String> = links.placeholder_to_target.keys().collect(); - assert!(placeholders.len() >= 2, "should have at least 2 placeholders"); + assert!( + placeholders.len() >= 2, + "should have at least 2 placeholders" + ); let targets: HashSet<&Ref> = links.placeholder_to_target.values().collect(); assert!(