fix some lints in tests

This commit is contained in:
Evan Almloff committed 2023-02-05 09:39:55 -06:00
1 parent 9dc63e67c9
commit 93f64d91c9
3 files changed
+42 -54

No files matched your search

@@ -1,15 +1,11 @@
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_core::*;
use dioxus_native_core::prelude::*; use dioxus_native_core::prelude::*;
use dioxus_native_core::{ use dioxus_native_core::{
dioxus::DioxusState, dioxus::DioxusState,
node_ref::{AttributeMaskBuilder, NodeMaskBuilder, NodeView}, node_ref::{NodeMaskBuilder, NodeView},
real_dom::RealDom, real_dom::RealDom,
Dependancy, Pass, SendAnyMap, Dependancy, Pass, SendAnyMap,
}; };
use rustc_hash::{FxHashMap, FxHashSet};
use std::any::TypeId;
use std::sync::{Arc, Mutex};
macro_rules! dep { macro_rules! dep {
( child( $name:ty, $dep:ty ) ) => { ( child( $name:ty, $dep:ty ) ) => {
@@ -24,7 +20,7 @@ macro_rules! dep {
&mut self, &mut self,
_: NodeView, _: NodeView,
_: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>, _: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>, _: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
_: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>, _: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>,
_: &SendAnyMap, _: &SendAnyMap,
) -> bool { ) -> bool {
@@ -58,7 +54,7 @@ macro_rules! dep {
&mut self, &mut self,
_: NodeView, _: NodeView,
_: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>, _: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>, _: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
_: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>, _: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>,
_: &SendAnyMap, _: &SendAnyMap,
) -> bool { ) -> bool {
@@ -92,7 +88,7 @@ macro_rules! dep {
&mut self, &mut self,
_: NodeView, _: NodeView,
_: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>, _: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>, _: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
_: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>, _: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>,
_: &SendAnyMap, _: &SendAnyMap,
) -> bool { ) -> bool {
+1 -4
View File
@@ -5,10 +5,6 @@ use dioxus_native_core::{
real_dom::RealDom, real_dom::RealDom,
Dependancy, Pass, SendAnyMap, Dependancy, Pass, SendAnyMap,
}; };
use std::{
borrow::BorrowMut,
sync::{Arc, Mutex},
};
use tokio::time::sleep; use tokio::time::sleep;
#[derive(Debug, Clone, PartialEq, Eq, Default)] #[derive(Debug, Clone, PartialEq, Eq, Default)]
@@ -99,6 +95,7 @@ mod dioxus_elements {
#[test] #[test]
fn native_core_is_okay() { fn native_core_is_okay() {
use std::sync::{Arc, Mutex};
use std::time::Duration; use std::time::Duration;
fn app(cx: Scope) -> Element { fn app(cx: Scope) -> Element {
+37 -42
View File
@@ -1,9 +1,6 @@
use dioxus::prelude::*;
use dioxus_native_core::node::NodeType; use dioxus_native_core::node::NodeType;
use dioxus_native_core::prelude::*; use dioxus_native_core::prelude::*;
use rustc_hash::{FxHashMap, FxHashSet}; use rustc_hash::{FxHashMap, FxHashSet};
use std::any::TypeId;
use std::sync::{Arc, Mutex};
fn create_blank_element() -> NodeType { fn create_blank_element() -> NodeType {
NodeType::Element(ElementNode { NodeType::Element(ElementNode {
@@ -27,11 +24,11 @@ fn node_pass() {
fn pass<'a>( fn pass<'a>(
&mut self, &mut self,
node_view: NodeView, _: NodeView,
node: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>, _: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>, _: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
children: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>, _: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>,
context: &SendAnyMap, _: &SendAnyMap,
) -> bool { ) -> bool {
self.0 += 1; self.0 += 1;
true true
@@ -75,11 +72,11 @@ fn dependant_node_pass() {
fn pass<'a>( fn pass<'a>(
&mut self, &mut self,
node_view: NodeView, _: NodeView,
node: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>, _: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>, _: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
children: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>, _: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>,
context: &SendAnyMap, _: &SendAnyMap,
) -> bool { ) -> bool {
self.0 += 1; self.0 += 1;
true true
@@ -109,11 +106,11 @@ fn dependant_node_pass() {
fn pass<'a>( fn pass<'a>(
&mut self, &mut self,
node_view: NodeView, _: NodeView,
node: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>, _: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>, _: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
children: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>, _: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>,
context: &SendAnyMap, _: &SendAnyMap,
) -> bool { ) -> bool {
self.0 -= 1; self.0 -= 1;
true true
@@ -175,11 +172,11 @@ fn independant_node_pass() {
fn pass<'a>( fn pass<'a>(
&mut self, &mut self,
node_view: NodeView, _: NodeView,
node: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>, _: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>, _: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
children: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>, _: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>,
context: &SendAnyMap, _: &SendAnyMap,
) -> bool { ) -> bool {
self.0 += 1; self.0 += 1;
true true
@@ -210,11 +207,11 @@ fn independant_node_pass() {
fn pass<'a>( fn pass<'a>(
&mut self, &mut self,
node_view: NodeView, _: NodeView,
node: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>, _: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>, _: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
children: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>, _: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>,
context: &SendAnyMap, _: &SendAnyMap,
) -> bool { ) -> bool {
self.0 -= 1; self.0 -= 1;
true true
@@ -284,14 +281,12 @@ fn down_pass() {
fn pass<'a>( fn pass<'a>(
&mut self, &mut self,
node_view: NodeView, _: NodeView,
node: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>, _: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>, parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
children: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>, _: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>,
context: &SendAnyMap, _: &SendAnyMap,
) -> bool { ) -> bool {
dbg!(parent);
dbg!(node_view);
if let Some((parent,)) = parent { if let Some((parent,)) = parent {
self.0 += parent.0; 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 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 grandchild1 = grandchild1.id();
let mut child1 = tree.create_node(create_blank_element(), true); let mut child1 = tree.create_node(create_blank_element(), true);
child1.add_child(grandchild1); child1.add_child(grandchild1);
let child1 = child1.id(); 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 grandchild2 = grandchild2.id();
let mut child2 = tree.create_node(create_blank_element(), true); let mut child2 = tree.create_node(create_blank_element(), true);
child2.add_child(grandchild2); child2.add_child(grandchild2);
@@ -374,11 +369,11 @@ fn up_pass() {
fn pass<'a>( fn pass<'a>(
&mut self, &mut self,
node_view: NodeView, _: NodeView,
node: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>, _: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>, _: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
children: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>, children: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>,
context: &SendAnyMap, _: &SendAnyMap,
) -> bool { ) -> bool {
if let Some(children) = children { if let Some(children) = children {
self.0 += children.iter().map(|(i,)| i.0).sum::<i32>(); self.0 += children.iter().map(|(i,)| i.0).sum::<i32>();
@@ -400,12 +395,12 @@ fn up_pass() {
} }
let mut tree: RealDom = RealDom::new(Box::new([AddNumber::to_type_erased()])); 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 grandchild1 = grandchild1.id();
let mut child1 = tree.create_node(create_blank_element(), true); let mut child1 = tree.create_node(create_blank_element(), true);
child1.add_child(grandchild1); child1.add_child(grandchild1);
let child1 = child1.id(); 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 grandchild2 = grandchild2.id();
let mut child2 = tree.create_node(create_blank_element(), true); let mut child2 = tree.create_node(create_blank_element(), true);
child2.add_child(grandchild2); child2.add_child(grandchild2);