clean up unused code
This commit is contained in:
1 parent
6f6f6c258f
commit
56154d90be
4 files changed
+5
-62
No files matched your search
@@ -35,35 +35,6 @@ fn impl_derive_macro(ast: &syn::DeriveInput) -> TokenStream {
|
|||||||
_ => unimplemented!(),
|
_ => unimplemented!(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let clone_or_default = fields.iter().map(|field| {
|
|
||||||
let field_name = field.ident.as_ref().unwrap();
|
|
||||||
let skip_clone = field
|
|
||||||
.attrs
|
|
||||||
.iter()
|
|
||||||
.any(|attr| attr.path.is_ident("skip_clone"));
|
|
||||||
if skip_clone {
|
|
||||||
quote! {
|
|
||||||
Default::default()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
quote! {
|
|
||||||
self.#field_name.clone()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
let non_clone_types = fields
|
|
||||||
.iter()
|
|
||||||
.filter(|field| {
|
|
||||||
field
|
|
||||||
.attrs
|
|
||||||
.iter()
|
|
||||||
.any(|attr| attr.path.is_ident("skip_clone"))
|
|
||||||
})
|
|
||||||
.map(|field| &field.ty);
|
|
||||||
|
|
||||||
let names = fields.iter().map(|field| field.ident.as_ref().unwrap());
|
|
||||||
|
|
||||||
let types = fields
|
let types = fields
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|field| !field.attrs.iter().any(|attr| attr.path.is_ident("skip")))
|
.filter(|field| !field.attrs.iter().any(|attr| attr.path.is_ident("skip")))
|
||||||
@@ -78,22 +49,6 @@ fn impl_derive_macro(ast: &syn::DeriveInput) -> TokenStream {
|
|||||||
),*
|
),*
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn clone_or_default(&self) -> Self {
|
|
||||||
Self {
|
|
||||||
#(
|
|
||||||
#names: #clone_or_default
|
|
||||||
),*
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn non_clone_members() -> Box<[std::any::TypeId]> {
|
|
||||||
Box::new([
|
|
||||||
#(
|
|
||||||
std::any::TypeId::of::<#non_clone_types>()
|
|
||||||
),*
|
|
||||||
])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -452,7 +452,7 @@ impl<S: State + Send> RealDom<S> {
|
|||||||
fn clone_node(&mut self, node_id: NodeId) -> NodeId {
|
fn clone_node(&mut self, node_id: NodeId) -> NodeId {
|
||||||
let node = self.tree.get(node_id).unwrap();
|
let node = self.tree.get(node_id).unwrap();
|
||||||
let new_node = Node {
|
let new_node = Node {
|
||||||
state: node.state.clone_or_default(),
|
state: node.state.clone(),
|
||||||
node_data: node.node_data.clone(),
|
node_data: node.node_data.clone(),
|
||||||
};
|
};
|
||||||
let new_id = self.create_node(new_node, true);
|
let new_id = self.create_node(new_node, true);
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
use crate::passes::{AnyMapLike, TypeErasedPass};
|
use crate::passes::{AnyMapLike, TypeErasedPass};
|
||||||
use std::any::TypeId;
|
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
||||||
/// Join two sorted iterators
|
/// Join two sorted iterators
|
||||||
@@ -41,14 +40,4 @@ pub(crate) fn union_ordered_iter<'a>(
|
|||||||
pub trait State: Default + Clone + AnyMapLike + 'static {
|
pub trait State: Default + Clone + AnyMapLike + 'static {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
fn create_passes() -> Box<[TypeErasedPass<Self>]>;
|
fn create_passes() -> Box<[TypeErasedPass<Self>]>;
|
||||||
|
|
||||||
#[doc(hidden)]
|
|
||||||
fn clone_or_default(&self) -> Self {
|
|
||||||
self.clone()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[doc(hidden)]
|
|
||||||
fn non_clone_members() -> Box<[TypeId]> {
|
|
||||||
Box::new([])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,6 @@ pub(crate) type TuiNode = dioxus_native_core::node::Node<NodeState>;
|
|||||||
|
|
||||||
#[derive(Debug, Clone, State, AnyMapLike, Default)]
|
#[derive(Debug, Clone, State, AnyMapLike, Default)]
|
||||||
pub(crate) struct NodeState {
|
pub(crate) struct NodeState {
|
||||||
#[skip_clone]
|
|
||||||
pub layout: TaffyLayout,
|
pub layout: TaffyLayout,
|
||||||
pub style: StyleModifier,
|
pub style: StyleModifier,
|
||||||
pub prevent_default: PreventDefault,
|
pub prevent_default: PreventDefault,
|
||||||
@@ -59,12 +58,12 @@ impl Pass for PreventDefault {
|
|||||||
fn pass<'a>(
|
fn pass<'a>(
|
||||||
&mut self,
|
&mut self,
|
||||||
node_view: dioxus_native_core::node_ref::NodeView,
|
node_view: dioxus_native_core::node_ref::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<
|
_: Option<
|
||||||
impl Iterator<Item = <Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>,
|
impl Iterator<Item = <Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>,
|
||||||
>,
|
>,
|
||||||
context: &SendAnyMap,
|
_: &SendAnyMap,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let new = match node_view.attributes().and_then(|mut attrs| {
|
let new = match node_view.attributes().and_then(|mut attrs| {
|
||||||
attrs
|
attrs
|
||||||
|
|||||||
Reference in new issue
Block a user