Fix clippy lint warnings (#1004)

This commit is contained in:
Jack T
2025-01-13 10:07:53 -08:00
committed by GitHub
parent f33d1f1cc4
commit 55a207a275
18 changed files with 69 additions and 76 deletions

View File

@@ -313,7 +313,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: snapshot_id,
snapshot_id,
properties: [("Self".to_owned(), Variant::Ref(snapshot_id))].into(),
metadata: Default::default(),
@@ -351,7 +351,7 @@ mod test {
// This patch describes the existing instance with a new child added.
let snapshot_id = Ref::new();
let snapshot = InstanceSnapshot {
snapshot_id: snapshot_id,
snapshot_id,
children: vec![InstanceSnapshot {
properties: [("Self".to_owned(), Variant::Ref(snapshot_id))].into(),

View File

@@ -9,7 +9,7 @@ use crate::{
#[test]
fn set_name_and_class_name() {
let mut redactions = RedactionMap::new();
let mut redactions = RedactionMap::default();
let mut tree = empty_tree();
intern_tree(&tree, &mut redactions);
@@ -36,7 +36,7 @@ fn set_name_and_class_name() {
#[test]
fn add_property() {
let mut redactions = RedactionMap::new();
let mut redactions = RedactionMap::default();
let mut tree = empty_tree();
intern_tree(&tree, &mut redactions);
@@ -63,7 +63,7 @@ fn add_property() {
#[test]
fn remove_property() {
let mut redactions = RedactionMap::new();
let mut redactions = RedactionMap::default();
let mut tree = empty_tree();
intern_tree(&tree, &mut redactions);
@@ -85,7 +85,7 @@ fn remove_property() {
id: tree.get_root_id(),
changed_name: None,
changed_class_name: None,
changed_properties: [("Foo".to_owned(), None).into()].into(),
changed_properties: [("Foo".to_owned(), None)].into(),
changed_metadata: None,
}],
..Default::default()

View File

@@ -9,7 +9,7 @@ use crate::snapshot::{compute_patch_set, InstanceSnapshot, RojoTree};
#[test]
fn set_name_and_class_name() {
let mut redactions = RedactionMap::new();
let mut redactions = RedactionMap::default();
let tree = empty_tree();
redactions.intern(tree.get_root_id());
@@ -31,7 +31,7 @@ fn set_name_and_class_name() {
#[test]
fn set_property() {
let mut redactions = RedactionMap::new();
let mut redactions = RedactionMap::default();
let tree = empty_tree();
redactions.intern(tree.get_root_id());
@@ -53,7 +53,7 @@ fn set_property() {
#[test]
fn remove_property() {
let mut redactions = RedactionMap::new();
let mut redactions = RedactionMap::default();
let mut tree = empty_tree();
redactions.intern(tree.get_root_id());
@@ -84,7 +84,7 @@ fn remove_property() {
#[test]
fn add_child() {
let mut redactions = RedactionMap::new();
let mut redactions = RedactionMap::default();
let tree = empty_tree();
redactions.intern(tree.get_root_id());
@@ -113,7 +113,7 @@ fn add_child() {
#[test]
fn remove_child() {
let mut redactions = RedactionMap::new();
let mut redactions = RedactionMap::default();
let mut tree = empty_tree();
redactions.intern(tree.get_root_id());

View File

@@ -148,7 +148,7 @@ impl RojoTree {
// We need to uphold the invariant that each ID can only map
// to one referent.
if let Some(new) = &metadata.specified_id {
if self.specified_id_to_refs.get(new).len() > 0 {
if !self.specified_id_to_refs.get(new).is_empty() {
log::error!("Duplicate user-specified referent '{new}'");
}
@@ -206,7 +206,7 @@ impl RojoTree {
}
if let Some(specified_id) = &metadata.specified_id {
if self.specified_id_to_refs.get(specified_id).len() > 0 {
if !self.specified_id_to_refs.get(specified_id).is_empty() {
log::error!("Duplicate user-specified referent '{specified_id}'");
}