From 93f64d91c9c4ad851ccdee51b8d25d4b436beda4 Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Sun, 5 Feb 2023 09:39:55 -0600 Subject: [PATCH] fix some lints in tests --- .../tests/called_minimally_on_build.rs | 12 +-- packages/native-core/tests/miri_native.rs | 5 +- packages/native-core/tests/passes.rs | 79 +++++++++---------- 3 files changed, 42 insertions(+), 54 deletions(-) diff --git a/packages/native-core/tests/called_minimally_on_build.rs b/packages/native-core/tests/called_minimally_on_build.rs index da0675688..44b8a43f9 100644 --- a/packages/native-core/tests/called_minimally_on_build.rs +++ b/packages/native-core/tests/called_minimally_on_build.rs @@ -1,15 +1,11 @@ use dioxus::prelude::*; -use dioxus_core::*; use dioxus_native_core::prelude::*; use dioxus_native_core::{ dioxus::DioxusState, - node_ref::{AttributeMaskBuilder, NodeMaskBuilder, NodeView}, + node_ref::{NodeMaskBuilder, NodeView}, real_dom::RealDom, Dependancy, Pass, SendAnyMap, }; -use rustc_hash::{FxHashMap, FxHashSet}; -use std::any::TypeId; -use std::sync::{Arc, Mutex}; macro_rules! dep { ( child( $name:ty, $dep:ty ) ) => { @@ -24,7 +20,7 @@ macro_rules! dep { &mut self, _: NodeView, _: ::ElementBorrowed<'a>, - parent: Option<::ElementBorrowed<'a>>, + _: Option<::ElementBorrowed<'a>>, _: Option::ElementBorrowed<'a>>>, _: &SendAnyMap, ) -> bool { @@ -58,7 +54,7 @@ macro_rules! dep { &mut self, _: NodeView, _: ::ElementBorrowed<'a>, - parent: Option<::ElementBorrowed<'a>>, + _: Option<::ElementBorrowed<'a>>, _: Option::ElementBorrowed<'a>>>, _: &SendAnyMap, ) -> bool { @@ -92,7 +88,7 @@ macro_rules! dep { &mut self, _: NodeView, _: ::ElementBorrowed<'a>, - parent: Option<::ElementBorrowed<'a>>, + _: Option<::ElementBorrowed<'a>>, _: Option::ElementBorrowed<'a>>>, _: &SendAnyMap, ) -> bool { diff --git a/packages/native-core/tests/miri_native.rs b/packages/native-core/tests/miri_native.rs index ead73b84d..384078672 100644 --- a/packages/native-core/tests/miri_native.rs +++ b/packages/native-core/tests/miri_native.rs @@ -5,10 +5,6 @@ use dioxus_native_core::{ real_dom::RealDom, Dependancy, Pass, SendAnyMap, }; -use std::{ - borrow::BorrowMut, - sync::{Arc, Mutex}, -}; use tokio::time::sleep; #[derive(Debug, Clone, PartialEq, Eq, Default)] @@ -99,6 +95,7 @@ mod dioxus_elements { #[test] fn native_core_is_okay() { + use std::sync::{Arc, Mutex}; use std::time::Duration; fn app(cx: Scope) -> Element { diff --git a/packages/native-core/tests/passes.rs b/packages/native-core/tests/passes.rs index ab104f5e5..f0023ae35 100644 --- a/packages/native-core/tests/passes.rs +++ b/packages/native-core/tests/passes.rs @@ -1,9 +1,6 @@ -use dioxus::prelude::*; use dioxus_native_core::node::NodeType; use dioxus_native_core::prelude::*; use rustc_hash::{FxHashMap, FxHashSet}; -use std::any::TypeId; -use std::sync::{Arc, Mutex}; fn create_blank_element() -> NodeType { NodeType::Element(ElementNode { @@ -27,11 +24,11 @@ fn node_pass() { fn pass<'a>( &mut self, - node_view: NodeView, - node: ::ElementBorrowed<'a>, - parent: Option<::ElementBorrowed<'a>>, - children: Option::ElementBorrowed<'a>>>, - context: &SendAnyMap, + _: NodeView, + _: ::ElementBorrowed<'a>, + _: Option<::ElementBorrowed<'a>>, + _: Option::ElementBorrowed<'a>>>, + _: &SendAnyMap, ) -> bool { self.0 += 1; true @@ -75,11 +72,11 @@ fn dependant_node_pass() { fn pass<'a>( &mut self, - node_view: NodeView, - node: ::ElementBorrowed<'a>, - parent: Option<::ElementBorrowed<'a>>, - children: Option::ElementBorrowed<'a>>>, - context: &SendAnyMap, + _: NodeView, + _: ::ElementBorrowed<'a>, + _: Option<::ElementBorrowed<'a>>, + _: Option::ElementBorrowed<'a>>>, + _: &SendAnyMap, ) -> bool { self.0 += 1; true @@ -109,11 +106,11 @@ fn dependant_node_pass() { fn pass<'a>( &mut self, - node_view: NodeView, - node: ::ElementBorrowed<'a>, - parent: Option<::ElementBorrowed<'a>>, - children: Option::ElementBorrowed<'a>>>, - context: &SendAnyMap, + _: NodeView, + _: ::ElementBorrowed<'a>, + _: Option<::ElementBorrowed<'a>>, + _: Option::ElementBorrowed<'a>>>, + _: &SendAnyMap, ) -> bool { self.0 -= 1; true @@ -175,11 +172,11 @@ fn independant_node_pass() { fn pass<'a>( &mut self, - node_view: NodeView, - node: ::ElementBorrowed<'a>, - parent: Option<::ElementBorrowed<'a>>, - children: Option::ElementBorrowed<'a>>>, - context: &SendAnyMap, + _: NodeView, + _: ::ElementBorrowed<'a>, + _: Option<::ElementBorrowed<'a>>, + _: Option::ElementBorrowed<'a>>>, + _: &SendAnyMap, ) -> bool { self.0 += 1; true @@ -210,11 +207,11 @@ fn independant_node_pass() { fn pass<'a>( &mut self, - node_view: NodeView, - node: ::ElementBorrowed<'a>, - parent: Option<::ElementBorrowed<'a>>, - children: Option::ElementBorrowed<'a>>>, - context: &SendAnyMap, + _: NodeView, + _: ::ElementBorrowed<'a>, + _: Option<::ElementBorrowed<'a>>, + _: Option::ElementBorrowed<'a>>>, + _: &SendAnyMap, ) -> bool { self.0 -= 1; true @@ -284,14 +281,12 @@ fn down_pass() { fn pass<'a>( &mut self, - node_view: NodeView, - node: ::ElementBorrowed<'a>, + _: NodeView, + _: ::ElementBorrowed<'a>, parent: Option<::ElementBorrowed<'a>>, - children: Option::ElementBorrowed<'a>>>, - context: &SendAnyMap, + _: Option::ElementBorrowed<'a>>>, + _: &SendAnyMap, ) -> bool { - dbg!(parent); - dbg!(node_view); if let Some((parent,)) = parent { self.0 += parent.0; } @@ -312,12 +307,12 @@ fn down_pass() { } let mut tree: RealDom = RealDom::new(Box::new([AddNumber::to_type_erased()])); - let mut grandchild1 = tree.create_node(create_blank_element(), true); + let grandchild1 = tree.create_node(create_blank_element(), true); let grandchild1 = grandchild1.id(); let mut child1 = tree.create_node(create_blank_element(), true); child1.add_child(grandchild1); let child1 = child1.id(); - let mut grandchild2 = tree.create_node(create_blank_element(), true); + let grandchild2 = tree.create_node(create_blank_element(), true); let grandchild2 = grandchild2.id(); let mut child2 = tree.create_node(create_blank_element(), true); child2.add_child(grandchild2); @@ -374,11 +369,11 @@ fn up_pass() { fn pass<'a>( &mut self, - node_view: NodeView, - node: ::ElementBorrowed<'a>, - parent: Option<::ElementBorrowed<'a>>, + _: NodeView, + _: ::ElementBorrowed<'a>, + _: Option<::ElementBorrowed<'a>>, children: Option::ElementBorrowed<'a>>>, - context: &SendAnyMap, + _: &SendAnyMap, ) -> bool { if let Some(children) = children { self.0 += children.iter().map(|(i,)| i.0).sum::(); @@ -400,12 +395,12 @@ fn up_pass() { } let mut tree: RealDom = RealDom::new(Box::new([AddNumber::to_type_erased()])); - let mut grandchild1 = tree.create_node(create_blank_element(), true); + let grandchild1 = tree.create_node(create_blank_element(), true); let grandchild1 = grandchild1.id(); let mut child1 = tree.create_node(create_blank_element(), true); child1.add_child(grandchild1); let child1 = child1.id(); - let mut grandchild2 = tree.create_node(create_blank_element(), true); + let grandchild2 = tree.create_node(create_blank_element(), true); let grandchild2 = grandchild2.id(); let mut child2 = tree.create_node(create_blank_element(), true); child2.add_child(grandchild2);