fix some lints in tests
This commit is contained in:
1 parent
9dc63e67c9
commit
93f64d91c9
3 files changed
+42
-54
No files matched your search
@@ -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,
|
||||
_: <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>>>,
|
||||
_: &SendAnyMap,
|
||||
) -> bool {
|
||||
@@ -58,7 +54,7 @@ macro_rules! dep {
|
||||
&mut self,
|
||||
_: NodeView,
|
||||
_: <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>>>,
|
||||
_: &SendAnyMap,
|
||||
) -> bool {
|
||||
@@ -92,7 +88,7 @@ macro_rules! dep {
|
||||
&mut self,
|
||||
_: NodeView,
|
||||
_: <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>>>,
|
||||
_: &SendAnyMap,
|
||||
) -> bool {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
|
||||
parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
|
||||
children: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>,
|
||||
context: &SendAnyMap,
|
||||
_: NodeView,
|
||||
_: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
|
||||
_: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
|
||||
_: Option<Vec<<Self::ChildDependencies as Dependancy>::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: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
|
||||
parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
|
||||
children: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>,
|
||||
context: &SendAnyMap,
|
||||
_: NodeView,
|
||||
_: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
|
||||
_: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
|
||||
_: Option<Vec<<Self::ChildDependencies as Dependancy>::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: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
|
||||
parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
|
||||
children: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>,
|
||||
context: &SendAnyMap,
|
||||
_: NodeView,
|
||||
_: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
|
||||
_: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
|
||||
_: Option<Vec<<Self::ChildDependencies as Dependancy>::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: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
|
||||
parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
|
||||
children: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>,
|
||||
context: &SendAnyMap,
|
||||
_: NodeView,
|
||||
_: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
|
||||
_: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
|
||||
_: Option<Vec<<Self::ChildDependencies as Dependancy>::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: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
|
||||
parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
|
||||
children: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>,
|
||||
context: &SendAnyMap,
|
||||
_: NodeView,
|
||||
_: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
|
||||
_: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
|
||||
_: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>,
|
||||
_: &SendAnyMap,
|
||||
) -> bool {
|
||||
self.0 -= 1;
|
||||
true
|
||||
@@ -284,14 +281,12 @@ fn down_pass() {
|
||||
|
||||
fn pass<'a>(
|
||||
&mut self,
|
||||
node_view: NodeView,
|
||||
node: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
|
||||
_: NodeView,
|
||||
_: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
|
||||
parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
|
||||
children: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>,
|
||||
context: &SendAnyMap,
|
||||
_: Option<Vec<<Self::ChildDependencies as Dependancy>::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: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
|
||||
parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
|
||||
_: NodeView,
|
||||
_: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
|
||||
_: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
|
||||
children: Option<Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>>,
|
||||
context: &SendAnyMap,
|
||||
_: &SendAnyMap,
|
||||
) -> bool {
|
||||
if let Some(children) = children {
|
||||
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 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);
|
||||
|
||||
Reference in new issue
Block a user