From a2f68c2e3c670b3bc5c3dbf45ebbdd3d11ef3ccf Mon Sep 17 00:00:00 2001 From: Kenneth Loeffler Date: Fri, 30 Jun 2023 11:05:55 -0700 Subject: [PATCH] Fix snapshot clippy lints (#685) The sixth in a series of PRs that aim to get CI passing --- src/snapshot/patch_apply.rs | 3 +-- src/snapshot/patch_compute.rs | 6 ++---- src/snapshot/tree.rs | 8 ++++---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/snapshot/patch_apply.rs b/src/snapshot/patch_apply.rs index 439452d8..5818776c 100644 --- a/src/snapshot/patch_apply.rs +++ b/src/snapshot/patch_apply.rs @@ -97,8 +97,7 @@ fn finalize_patch_application(context: PatchApplyContext, tree: &mut RojoTree) - for value in instance.properties_mut().values_mut() { if let Variant::Ref(referent) = value { - if let Some(&instance_referent) = context.snapshot_id_to_instance_id.get(&referent) - { + if let Some(&instance_referent) = context.snapshot_id_to_instance_id.get(referent) { *value = Variant::Ref(instance_referent); } } diff --git a/src/snapshot/patch_compute.rs b/src/snapshot/patch_compute.rs index 23e2f302..f5d5a67b 100644 --- a/src/snapshot/patch_compute.rs +++ b/src/snapshot/patch_compute.rs @@ -26,10 +26,8 @@ pub fn compute_patch_set(snapshot: Option, tree: &RojoTree, id // for all of the IDs that we know about so far. rewrite_refs_in_updates(&context, &mut patch_set.updated_instances); rewrite_refs_in_additions(&context, &mut patch_set.added_instances); - } else { - if id != tree.get_root_id() { - patch_set.removed_instances.push(id); - } + } else if id != tree.get_root_id() { + patch_set.removed_instances.push(id); } patch_set diff --git a/src/snapshot/tree.rs b/src/snapshot/tree.rs index e342e186..e4379bc2 100644 --- a/src/snapshot/tree.rs +++ b/src/snapshot/tree.rs @@ -37,8 +37,8 @@ pub struct RojoTree { impl RojoTree { pub fn new(snapshot: InstanceSnapshot) -> RojoTree { - let root_builder = InstanceBuilder::new(snapshot.class_name.to_owned()) - .with_name(snapshot.name.to_owned()) + let root_builder = InstanceBuilder::new(snapshot.class_name) + .with_name(snapshot.name) .with_properties(snapshot.properties); let mut tree = RojoTree { @@ -245,7 +245,7 @@ impl<'a> InstanceWithMeta<'a> { } pub fn metadata(&self) -> &'a InstanceMetadata { - &self.metadata + self.metadata } } @@ -294,6 +294,6 @@ impl InstanceWithMetaMut<'_> { } pub fn metadata(&self) -> &InstanceMetadata { - &self.metadata + self.metadata } }