Removed InstanceSnapshot snapshot_id's redudant Ref. (#730)

Ref now is an optional inside, so it's redundant to have an option
wrapping an option. The only snapshots that were changed were any that
had a Ref within (from none to zeroed). Some also had some newlines
added in the end.
This commit is contained in:
utrain
2023-07-12 13:00:09 -04:00
committed by GitHub
parent 623fa06d52
commit 80eb14f9da
29 changed files with 58 additions and 69 deletions

View File

@@ -77,8 +77,10 @@ fn compute_patch_set_internal(
id: Ref,
patch_set: &mut PatchSet,
) {
if let Some(snapshot_id) = snapshot.snapshot_id {
context.snapshot_id_to_instance_id.insert(snapshot_id, id);
if snapshot.snapshot_id.is_some() {
context
.snapshot_id_to_instance_id
.insert(snapshot.snapshot_id, id);
}
let instance = tree
@@ -244,7 +246,7 @@ mod test {
// addition of a prop named Self, which is a self-referential Ref.
let snapshot_id = Ref::new();
let snapshot = InstanceSnapshot {
snapshot_id: Some(snapshot_id),
snapshot_id: snapshot_id,
properties: hashmap! {
"Self".to_owned() => Variant::Ref(snapshot_id),
},
@@ -286,13 +288,13 @@ mod test {
// This patch describes the existing instance with a new child added.
let snapshot_id = Ref::new();
let snapshot = InstanceSnapshot {
snapshot_id: Some(snapshot_id),
snapshot_id: snapshot_id,
children: vec![InstanceSnapshot {
properties: hashmap! {
"Self".to_owned() => Variant::Ref(snapshot_id),
},
snapshot_id: None,
snapshot_id: Ref::none(),
metadata: Default::default(),
name: Cow::Borrowed("child"),
class_name: Cow::Borrowed("child"),
@@ -311,7 +313,7 @@ mod test {
added_instances: vec![PatchAdd {
parent_id: root_id,
instance: InstanceSnapshot {
snapshot_id: None,
snapshot_id: Ref::none(),
metadata: Default::default(),
properties: hashmap! {
"Self".to_owned() => Variant::Ref(root_id),