diff --git a/packages/core/examples/alternative.rs b/packages/core/examples/alternative.rs index 7f6100677..65e7d227a 100644 --- a/packages/core/examples/alternative.rs +++ b/packages/core/examples/alternative.rs @@ -1,10 +1,10 @@ //! An alternative function syntax //! -use std::marker::PhantomData; + use bumpalo::Bump; -use dioxus_core::prelude::{DomTree, VNode}; +use dioxus_core::prelude::{VNode}; fn main() {} @@ -13,7 +13,7 @@ struct Context2<'a, P> { rops: &'a P, // _p: PhantomData<&'a ()>, } impl<'a, P> Context2<'a, P> { - fn view(self, f: impl FnOnce(&'a Bump) -> VNode<'a>) -> DTree { + fn view(self, _f: impl FnOnce(&'a Bump) -> VNode<'a>) -> DTree { DTree {} } @@ -23,9 +23,9 @@ impl<'a, P> Context2<'a, P> { pub fn use_hook<'scope, InternalHookState: 'static, Output: 'a>( &'scope self, - initializer: impl FnOnce() -> InternalHookState, - runner: impl FnOnce(&'a mut InternalHookState) -> Output, - cleanup: impl FnOnce(InternalHookState), + _initializer: impl FnOnce() -> InternalHookState, + _runner: impl FnOnce(&'a mut InternalHookState) -> Output, + _cleanup: impl FnOnce(InternalHookState), ) -> Output { todo!() } @@ -35,7 +35,7 @@ trait Properties {} struct DTree; // type FC2<'a, T: 'a> = fn(Context2) -> DTree; -fn virtual_child<'a, T: 'a>(bump: &'a Bump, props: T, f: FC2) -> VNode<'a> { +fn virtual_child<'a, T: 'a>(_bump: &'a Bump, _props: T, _f: FC2) -> VNode<'a> { todo!() } @@ -56,7 +56,7 @@ fn Example(ctx: Context2) -> DTree { } // #[fc] -fn Example2(ctx: Context2<()>, name: &str, blah: &str) -> DTree { +fn Example2(ctx: Context2<()>, name: &str, _blah: &str) -> DTree { let val = use_state(&ctx, || String::from("asd")); ctx.view(move |b| { @@ -67,10 +67,10 @@ fn Example2(ctx: Context2<()>, name: &str, blah: &str) -> DTree { }) } -type FC2<'a, T: 'a> = fn(Context2) -> DTree; +type FC2<'a, T> = fn(Context2) -> DTree; // still works if you don't take any references in your props (ie, something copy or cloneable) -static CHILD: FC2 = |ctx: Context2| { +static CHILD: FC2 = |_ctx: Context2| { // todo!() }; @@ -81,15 +81,15 @@ struct Props2<'a> { impl Properties for Props2<'_> {} fn AltChild(ctx: Context2) -> DTree { - ctx.view(|b| { + ctx.view(|_b| { // todo!() }) } fn use_state<'a, 'c, P, T: 'static, F: FnOnce() -> T>( - ctx: &'_ Context2<'a, P>, - initial_state_fn: F, -) -> (&'a T) { + _ctx: &'_ Context2<'a, P>, + _initial_state_fn: F, +) -> &'a T { todo!() } diff --git a/packages/core/examples/borrowed.rs b/packages/core/examples/borrowed.rs index 310052172..562349239 100644 --- a/packages/core/examples/borrowed.rs +++ b/packages/core/examples/borrowed.rs @@ -38,6 +38,6 @@ struct ChildProps<'a> { item: &'a ListItem, } -fn child_item(ctx: Context, props: &ChildProps) -> DomTree { +fn child_item(_ctx: Context, _props: &ChildProps) -> DomTree { todo!() } diff --git a/packages/core/examples/contextapi.rs b/packages/core/examples/contextapi.rs index 38cd68268..8d511f326 100644 --- a/packages/core/examples/contextapi.rs +++ b/packages/core/examples/contextapi.rs @@ -1,6 +1,6 @@ -use std::{borrow::Borrow, marker::PhantomData, ops::Deref}; -use builder::{button, div}; + +use builder::{button}; use dioxus_core::prelude::*; fn main() {} diff --git a/packages/core/examples/dummy.rs b/packages/core/examples/dummy.rs index 2c0e3d51c..098d2681b 100644 --- a/packages/core/examples/dummy.rs +++ b/packages/core/examples/dummy.rs @@ -4,7 +4,7 @@ // use dioxus_core::prelude::VNode; // use dioxus_core::prelude::*; // use once_cell::sync::{Lazy, OnceCell}; -use std::{collections::HashMap, future::Future, marker::PhantomData}; + use std::ops::Deref; @@ -49,14 +49,14 @@ struct Context<'a> { } impl<'a> Context<'a> { - fn use_context<'b, I, O: 'b>(&self, f: fn(&'b I) -> O) -> ContextGuard2 { + fn use_context<'b, I, O: 'b>(&self, _f: fn(&'b I) -> O) -> ContextGuard2 { todo!() } - fn add_listener(&self, f: impl Fn(()) + 'a) { + fn add_listener(&self, _f: impl Fn(()) + 'a) { todo!() } - fn view(self, f: impl FnOnce(&'a String) + 'a) {} + fn view(self, _f: impl FnOnce(&'a String) + 'a) {} // fn view(self, f: impl for<'b> FnOnce(&'a String) + 'a) {} // fn view(self, f: impl for<'b> FnOnce(&'b String) + 'a) {} } @@ -77,7 +77,7 @@ fn t<'a>(ctx: Context<'a>) { ctx.add_listener(move |_| { // let val = value.get().as_str(); - let val2 = r2.as_bytes(); + let _val2 = r2.as_bytes(); println!("v2 is {}", r2); // println!("refed is {}", refed); }); @@ -97,7 +97,7 @@ fn t<'a>(ctx: Context<'a>) { // let val2 = refed.as_bytes(); }); - ctx.view(move |b| {}); + ctx.view(move |_b| {}); } fn main() {} diff --git a/packages/core/examples/props.rs b/packages/core/examples/props.rs index 4b95619e5..a3289c698 100644 --- a/packages/core/examples/props.rs +++ b/packages/core/examples/props.rs @@ -25,7 +25,7 @@ struct OutputNode<'a> { // everything is managed at runtime because that's how we make something ergonomc // lifetime management in dioxus is just cheating around the rules // our kind god manages lifetimes for us so we don't have to, thanks god -fn something<'s>(props: &'s SomeProps<'s>) -> OutputNode<'s> { +fn something<'s>(_props: &'s SomeProps<'s>) -> OutputNode<'s> { todo!() } diff --git a/packages/core/examples/step.rs b/packages/core/examples/step.rs index ce8f1a441..8a1272049 100644 --- a/packages/core/examples/step.rs +++ b/packages/core/examples/step.rs @@ -10,7 +10,7 @@ use dioxus_core::prelude::*; fn main() -> Result<(), ()> { let p1 = Props { name: "bob".into() }; - let mut vdom = VirtualDom::new_with_props(Example, p1); + let _vdom = VirtualDom::new_with_props(Example, p1); // vdom.progress()?; Ok(()) @@ -29,7 +29,7 @@ struct Props { // // } // } -static Example: FC = |ctx, props| { +static Example: FC = |ctx, _props| { ctx.view(html! {

"hello world!"

diff --git a/packages/core/src/changelist.rs b/packages/core/src/changelist.rs index 44b8b01f6..dc852520d 100644 --- a/packages/core/src/changelist.rs +++ b/packages/core/src/changelist.rs @@ -19,11 +19,11 @@ //! //! -use std::ops::{Deref, DerefMut}; + use bumpalo::Bump; -use crate::innerlude::{Listener, VirtualDom}; +use crate::innerlude::{Listener}; /// The `Edit` represents a single modifcation of the renderer tree. /// @@ -73,7 +73,7 @@ pub struct EditMachine<'src> { } impl<'b> EditMachine<'b> { - pub fn new(bump: &'b Bump) -> Self { + pub fn new(_bump: &'b Bump) -> Self { Self { traversal: Traversal::new(), next_temporary: 0, @@ -206,7 +206,7 @@ impl<'a> EditMachine<'a> { self.emitter.push(Edit::InsertBefore {}) } - pub fn ensure_string(&mut self, string: &str) -> StringKey { + pub fn ensure_string(&mut self, _string: &str) -> StringKey { todo!() // self.strings.ensure_string(string, &self.emitter) } @@ -308,7 +308,7 @@ impl<'a> EditMachine<'a> { self.forcing_new_listeners = previous; } - pub fn new_event_listener(&mut self, listener: &Listener) { + pub fn new_event_listener(&mut self, _listener: &Listener) { debug_assert!(self.traversal_is_committed()); todo!("Event listener not wired up yet"); // debug!("emit: new_event_listener({:?})", listener); @@ -330,14 +330,14 @@ impl<'a> EditMachine<'a> { todo!("Event listener not wired up yet"); // let (a, b) = listener.get_callback_parts(); // debug_assert!(a != 0); - let event_id = self.ensure_string(listener.event); + let _event_id = self.ensure_string(listener.event); // self.emitter.update_event_listener(event_id.into(), a, b); } pub fn remove_event_listener(&mut self, event: &str) { debug_assert!(self.traversal_is_committed()); // debug!("emit: remove_event_listener({:?})", event); - let event_id = self.ensure_string(event); + let _event_id = self.ensure_string(event); todo!("Event listener not wired up yet"); // self.emitter.remove_event_listener(event_id.into()); } diff --git a/packages/core/src/component.rs b/packages/core/src/component.rs index dd7328c33..2dff2906a 100644 --- a/packages/core/src/component.rs +++ b/packages/core/src/component.rs @@ -2,10 +2,6 @@ //! for components to be used within Nodes. //! -use std::fmt::Debug; - -use crate::innerlude::*; - /// The `Component` trait refers to any struct or funciton that can be used as a component /// We automatically implement Component for FC // pub trait Component { @@ -39,8 +35,8 @@ use crate::innerlude::*; #[cfg(test)] mod tests { - use super::*; use crate::prelude::bumpalo::Bump; + use crate::prelude::*; fn test_static_fn<'a, P>(b: &'a Bump, r: FC

) -> VNode<'a> { todo!() diff --git a/packages/core/src/context.rs b/packages/core/src/context.rs index 576801059..abb6cc9e4 100644 --- a/packages/core/src/context.rs +++ b/packages/core/src/context.rs @@ -1,5 +1,5 @@ use crate::prelude::*; -use crate::{innerlude::Scope, nodes::VNode}; +use crate::{nodes::VNode}; use bumpalo::Bump; use hooks::Hook; use std::{ @@ -76,18 +76,18 @@ impl<'a> Context<'a> { // pub fn view(self, lazy_nodes: impl for<'b> FnOnce(&'b Bump) -> VNode<'b> + 'a + 'p) -> DomTree { // pub fn view<'p>(self, lazy_nodes: impl FnOnce(&'a Bump) -> VNode<'a> + 'a + 'p) -> DomTree { // pub fn view(self, lazy_nodes: impl FnOnce(&'a Bump) -> VNode<'a> + 'a) -> VNode<'a> { - let g = lazy_nodes(self.bump); + let _g = lazy_nodes(self.bump); DomTree {} } - pub fn callback(&self, f: impl Fn(()) + 'a) {} + pub fn callback(&self, _f: impl Fn(()) + 'a) {} /// Create a suspended component from a future. /// /// When the future completes, the component will be renderered pub fn suspend( &self, - fut: impl Future VNode<'a>>, + _fut: impl Future VNode<'a>>, ) -> VNode<'a> { todo!() } @@ -119,7 +119,7 @@ pub mod hooks { runner: impl FnOnce(&'a mut InternalHookState) -> Output, // The closure that cleans up whatever mess is left when the component gets torn down // TODO: add this to the "clean up" group for when the component is dropped - cleanup: impl FnOnce(InternalHookState), + _cleanup: impl FnOnce(InternalHookState), ) -> Output { let raw_hook = { let idx = self.idx.load(std::sync::atomic::Ordering::Relaxed); @@ -186,9 +186,9 @@ mod context_api { //! a failure of implementation. //! //! - use super::*; + - use std::{marker::PhantomPinned, mem::swap, ops::Deref}; + use std::{ops::Deref}; pub struct RemoteState { inner: *const T, @@ -229,7 +229,7 @@ Context should *never* be dangling!. If a Context is torn down, so should anythi impl<'a> super::Context<'a> { // impl<'a, P> super::Context<'a, P> { - pub fn use_context(&'a self, narrow: impl Fn(&'_ I) -> &'_ O) -> RemoteState { + pub fn use_context(&'a self, _narrow: impl Fn(&'_ I) -> &'_ O) -> RemoteState { todo!() } } diff --git a/packages/core/src/dodriodiff.rs b/packages/core/src/dodriodiff.rs index 152c12d1b..a826db62b 100644 --- a/packages/core/src/dodriodiff.rs +++ b/packages/core/src/dodriodiff.rs @@ -950,7 +950,7 @@ impl<'a> DiffMachine<'a> { // When this function returns, the change list stack is in the same state. pub fn remove_all_children(&mut self, old: &[VNode<'a>]) { debug_assert!(self.change_list.traversal_is_committed()); - for child in old { + for _child in old { // registry.remove_subtree(child); } // Fast way to remove all children: set the node's textContent to an empty @@ -984,7 +984,7 @@ impl<'a> DiffMachine<'a> { // [... parent] pub fn remove_self_and_next_siblings(&mut self, old: &[VNode<'a>]) { debug_assert!(self.change_list.traversal_is_committed()); - for child in old { + for _child in old { // registry.remove_subtree(child); } self.change_list.remove_self_and_next_siblings(); @@ -1001,7 +1001,7 @@ enum KeyedPrefixResult { } mod support { - use super::*; + // // Get or create the template. // // diff --git a/packages/core/src/lib.rs b/packages/core/src/lib.rs index 19f7c8fab..b60736c99 100644 --- a/packages/core/src/lib.rs +++ b/packages/core/src/lib.rs @@ -88,7 +88,7 @@ pub mod builder { // types used internally that are important pub(crate) mod innerlude { // pub(crate) use crate::component::Properties; - use crate::context::hooks::Hook; + pub(crate) use crate::context::Context; pub(crate) use crate::error::{Error, Result}; use crate::nodes; @@ -102,7 +102,7 @@ pub(crate) mod innerlude { pub type FC

= for<'scope> fn(Context<'scope>, &'scope P) -> DomTree; mod fc2 { - use super::*; + } // pub type FC<'a, P: 'a> = for<'scope> fn(Context<'scope>, &'scope P) -> DomTree; // pub type FC

= for<'scope, 'r> fn(Context<'scope>, &'scope P) -> DomTree; diff --git a/packages/core/src/nodebuilder.rs b/packages/core/src/nodebuilder.rs index c80fd4b0d..e4ba2d4ce 100644 --- a/packages/core/src/nodebuilder.rs +++ b/packages/core/src/nodebuilder.rs @@ -335,7 +335,7 @@ where /// .finish(); /// ``` #[inline] - pub fn on(mut self, event: &'a str, callback: impl Fn(()) + 'a) -> Self + pub fn on(self, _event: &'a str, _callback: impl Fn(()) + 'a) -> Self // pub fn on(mut self, event: &'a str, callback: impl Fn(()) -> () + 'static) -> Self // F: Fn(()) + 'static, // F: Fn(()) + 'a, @@ -1081,7 +1081,7 @@ pub fn on<'a, 'b, F: 'static>( } } -pub fn virtual_child<'a, T>(bump: &'a Bump, props: T, f: crate::innerlude::FC) -> VNode<'a> { +pub fn virtual_child<'a, T>(_bump: &'a Bump, _props: T, _f: crate::innerlude::FC) -> VNode<'a> { todo!() // VNode::Component() } diff --git a/packages/core/src/nodes.rs b/packages/core/src/nodes.rs index 38db1a9e8..5a229290f 100644 --- a/packages/core/src/nodes.rs +++ b/packages/core/src/nodes.rs @@ -3,7 +3,7 @@ //! //! These VNodes should be *very* cheap and *very* fast to construct - building a full tree should be insanely quick. -use std::marker::PhantomData; + use bumpalo::Bump; pub use vcomponent::VComponent; @@ -97,7 +97,7 @@ mod vnode { mod velement { use super::*; - use std::{collections::HashMap, fmt::Debug}; + use std::{fmt::Debug}; #[derive(Debug)] pub struct VElement<'a> { @@ -133,7 +133,7 @@ mod velement { impl<'a> VElement<'a> { // The tag of a component MUST be known at compile time - pub fn new(tag: &'a str) -> Self { + pub fn new(_tag: &'a str) -> Self { todo!() // VElement { // tag, @@ -265,9 +265,9 @@ mod vtext { /// Only supports the functional syntax mod vcomponent { use crate::innerlude::FC; - use std::{any::TypeId, fmt, future::Future, marker::PhantomData}; + use std::{marker::PhantomData}; - use super::VNode; + #[derive(Debug)] pub struct VComponent<'src> { @@ -279,8 +279,8 @@ mod vcomponent { impl<'a> VComponent<'a> { pub fn new

(caller: FC

, props: P) -> Self { - let caller = caller as *const (); - let props = Box::new(props); + let _caller = caller as *const (); + let _props = Box::new(props); todo!() // Self { diff --git a/packages/core/src/scope.rs b/packages/core/src/scope.rs index d2be5d4c1..ebf57d3f8 100644 --- a/packages/core/src/scope.rs +++ b/packages/core/src/scope.rs @@ -3,7 +3,7 @@ use crate::innerlude::*; use crate::nodes::VNode; use bumpalo::Bump; use generational_arena::Index; -use owning_ref::StableAddress; + use std::{ any::TypeId, borrow::{Borrow, BorrowMut}, @@ -105,7 +105,7 @@ impl Scope { /// Update this component's props with a new set of props, remotely /// /// - pub(crate) fn update_props<'a, P>(&self, new_props: P) -> crate::error::Result<()> { + pub(crate) fn update_props<'a, P>(&self, _new_props: P) -> crate::error::Result<()> { Ok(()) } @@ -133,7 +133,7 @@ impl Scope { // these lifetimes could be very broken, so we need to dynamically manage them let caller = std::mem::transmute::<*const (), FC>(self.caller); let props = self.props.downcast_ref::().unwrap(); - let nodes: DomTree = caller(ctx, props); + let _nodes: DomTree = caller(ctx, props); todo!("absorb domtree into self") // let nodes: VNode<'bump> = caller(ctx, props); diff --git a/packages/core/src/virtual_dom.rs b/packages/core/src/virtual_dom.rs index 49cb54068..1b783d65a 100644 --- a/packages/core/src/virtual_dom.rs +++ b/packages/core/src/virtual_dom.rs @@ -2,12 +2,11 @@ use crate::{ changelist::{self, EditList}, dodriodiff::DiffMachine, - nodes::VNode, }; use crate::{events::EventTrigger, innerlude::*}; -use any::Any; + use bumpalo::Bump; -use changelist::EditMachine; + use generational_arena::{Arena, Index}; use std::{ any::{self, TypeId}, @@ -107,7 +106,7 @@ impl VirtualDom { let EventTrigger { component_id, listener_id, - event, + event: _, } = evt; let component = self @@ -159,13 +158,13 @@ impl VirtualDom { fn process_lifecycle(&mut self, LifecycleEvent { event_type }: LifecycleEvent) -> Result<()> { match event_type { // Component needs to be mounted to the virtual dom - LifecycleType::Mount { to, under, props } => {} + LifecycleType::Mount { to: _, under: _, props: _ } => {} // The parent for this component generated new props and the component needs update - LifecycleType::PropsChanged { props, component } => {} + LifecycleType::PropsChanged { props: _, component: _ } => {} // Component was messaged via the internal subscription service - LifecycleType::Callback { component } => {} + LifecycleType::Callback { component: _ } => {} } Ok(()) @@ -216,7 +215,7 @@ pub enum LifecycleType { impl LifecycleEvent { fn index(&self) -> Option { match &self.event_type { - LifecycleType::Mount { to, under, props } => None, + LifecycleType::Mount { to: _, under: _, props: _ } => None, LifecycleType::PropsChanged { component, .. } | LifecycleType::Callback { component } => Some(component.clone()), diff --git a/packages/core/tests/integration.rs b/packages/core/tests/integration.rs index 0e144295e..4aca69f33 100644 --- a/packages/core/tests/integration.rs +++ b/packages/core/tests/integration.rs @@ -4,7 +4,7 @@ /// /// // use crate::prelude::*; -use dioxus_core::prelude::*; + // type VirtualNode = VNode; /// Test a basic usage of a virtual dom + text renderer combo