FIx: cargo fix to clean up things
This commit is contained in:
1 parent
29751a4bab
commit
78d093a945
23 files changed
+91
-101
No files matched your search
@@ -29,6 +29,6 @@ impl Properties for () {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fc_to_builder<T: Properties>(f: FC<T>) -> T::Builder {
|
||||
pub fn fc_to_builder<T: Properties>(_f: FC<T>) -> T::Builder {
|
||||
T::builder()
|
||||
}
|
||||
@@ -34,11 +34,10 @@
|
||||
//! - https://hacks.mozilla.org/2019/03/fast-bump-allocated-virtual-doms-with-rust-and-wasm/
|
||||
use crate::{
|
||||
innerlude::*,
|
||||
scope::{create_scoped, Scoped},
|
||||
};
|
||||
use bumpalo::Bump;
|
||||
use fxhash::{FxHashMap, FxHashSet};
|
||||
use generational_arena::Arena;
|
||||
|
||||
use std::{cell::RefCell, cmp::Ordering, collections::VecDeque, rc::Rc};
|
||||
|
||||
/// The DiffState is a cursor internal to the VirtualDOM's diffing algorithm that allows persistence of state while
|
||||
@@ -112,7 +111,7 @@ impl<'a> DiffMachine<'a> {
|
||||
self.diff_children(eold.children, enew.children);
|
||||
}
|
||||
|
||||
(VNode::Component(cold), VNode::Component(cnew)) => {
|
||||
(VNode::Component(_cold), VNode::Component(_cnew)) => {
|
||||
// if cold.comp != cnew.comp {
|
||||
// // queue an event to mount this new component
|
||||
// return;
|
||||
@@ -123,7 +122,7 @@ impl<'a> DiffMachine<'a> {
|
||||
todo!("Usage of component VNode not currently supported");
|
||||
}
|
||||
|
||||
(_, VNode::Component(new)) => {
|
||||
(_, VNode::Component(_new)) => {
|
||||
// we have no stable reference to work from
|
||||
// push the lifecycle event onto the queue
|
||||
// self.lifecycle_events
|
||||
@@ -142,7 +141,7 @@ impl<'a> DiffMachine<'a> {
|
||||
// push the current
|
||||
}
|
||||
|
||||
(VNode::Component(old), _) => {
|
||||
(VNode::Component(_old), _) => {
|
||||
todo!("Usage of component VNode not currently supported");
|
||||
}
|
||||
|
||||
@@ -165,7 +164,7 @@ impl<'a> DiffMachine<'a> {
|
||||
self.change_list.commit_traversal();
|
||||
}
|
||||
|
||||
'outer1: for (l_idx, new_l) in new.iter().enumerate() {
|
||||
'outer1: for (_l_idx, new_l) in new.iter().enumerate() {
|
||||
// unsafe {
|
||||
// Safety relies on removing `new_l` from the registry manually at
|
||||
// the end of its lifetime. This happens below in the `'outer2`
|
||||
@@ -818,7 +817,7 @@ impl<'a> DiffMachine<'a> {
|
||||
self.change_list.create_element(tag_name);
|
||||
}
|
||||
|
||||
listeners.iter().enumerate().for_each(|(id, listener)| {
|
||||
listeners.iter().enumerate().for_each(|(_id, listener)| {
|
||||
self.change_list
|
||||
.new_event_listener(listener.event, listener.scope, listener.id)
|
||||
});
|
||||
|
||||
@@ -137,7 +137,7 @@ mod use_reducer_def {
|
||||
pub fn use_reducer<'a, 'c, State: 'static, Action: 'static>(
|
||||
ctx: &'c Context<'a>,
|
||||
initial_state_fn: impl FnOnce() -> State,
|
||||
reducer: impl Fn(&mut State, Action),
|
||||
_reducer: impl Fn(&mut State, Action),
|
||||
) -> (&'a State, &'a impl Fn(Action)) {
|
||||
ctx.use_hook(
|
||||
move || UseReducer {
|
||||
@@ -146,7 +146,7 @@ mod use_reducer_def {
|
||||
caller: Box::new(|_| println!("setter called!")),
|
||||
},
|
||||
move |hook| {
|
||||
let inner = hook.new_val.clone();
|
||||
let _inner = hook.new_val.clone();
|
||||
let scheduled_update = ctx.schedule_update();
|
||||
|
||||
// get ownership of the new val and replace the current with the new
|
||||
@@ -157,7 +157,7 @@ mod use_reducer_def {
|
||||
}
|
||||
|
||||
// todo: swap out the caller with a subscription call and an internal update
|
||||
hook.caller = Box::new(move |new_val| {
|
||||
hook.caller = Box::new(move |_new_val| {
|
||||
// update the setter with the new value
|
||||
// let mut new_inner = inner.as_ref().borrow_mut();
|
||||
// *new_inner = Some(new_val);
|
||||
@@ -175,9 +175,9 @@ mod use_reducer_def {
|
||||
|
||||
// #[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use crate::prelude::*;
|
||||
use bumpalo::Bump;
|
||||
|
||||
enum Actions {
|
||||
Incr,
|
||||
Decr,
|
||||
|
||||
@@ -91,11 +91,11 @@ pub(crate) mod innerlude {
|
||||
// pub(crate) use crate::component::Properties;
|
||||
pub(crate) use crate::component::Properties;
|
||||
pub(crate) use crate::context::Context;
|
||||
pub(crate) use crate::error::{Error, Result};
|
||||
pub(crate) use crate::error::{Result};
|
||||
pub use crate::events::EventTrigger;
|
||||
use crate::nodes;
|
||||
pub(crate) use crate::scope::Scope;
|
||||
pub(crate) use crate::virtual_dom::VirtualDom;
|
||||
|
||||
|
||||
pub(crate) use nodes::*;
|
||||
|
||||
pub use crate::component::ScopeIdx;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Helpers for building virtual DOM VNodes.
|
||||
|
||||
use std::{borrow::BorrowMut, ops::Deref};
|
||||
use std::{borrow::BorrowMut};
|
||||
|
||||
use crate::{
|
||||
context::NodeCtx,
|
||||
@@ -10,8 +10,8 @@ use crate::{
|
||||
prelude::VElement,
|
||||
};
|
||||
|
||||
use bumpalo::format;
|
||||
use bumpalo::Bump;
|
||||
|
||||
|
||||
|
||||
/// A virtual DOM element builder.
|
||||
///
|
||||
@@ -339,7 +339,7 @@ where
|
||||
/// })
|
||||
/// .finish();
|
||||
/// ```
|
||||
pub fn on(mut self, event: &'static str, callback: impl Fn(VirtualEvent) + 'a) -> Self {
|
||||
pub fn on(self, event: &'static str, callback: impl Fn(VirtualEvent) + 'a) -> Self {
|
||||
let listener = Listener {
|
||||
event,
|
||||
callback: self.ctx.bump.alloc(callback),
|
||||
@@ -527,9 +527,9 @@ pub fn attr<'a>(name: &'static str, value: &'a str) -> Attribute<'a> {
|
||||
// _f: crate::innerlude::FC<T>,
|
||||
// _props: T
|
||||
pub fn virtual_child<'a, 'b, T: crate::innerlude::Properties>(
|
||||
ctx: &'b NodeCtx<'a>,
|
||||
f: FC<T>,
|
||||
p: T,
|
||||
_ctx: &'b NodeCtx<'a>,
|
||||
_f: FC<T>,
|
||||
_p: T,
|
||||
) -> VNode<'a> {
|
||||
// crate::nodes::VComponent
|
||||
todo!()
|
||||
|
||||
@@ -11,7 +11,7 @@ use crate::{
|
||||
use bumpalo::Bump;
|
||||
use std::fmt::Debug;
|
||||
use std::{
|
||||
any::{Any, TypeId},
|
||||
any::{Any},
|
||||
cell::RefCell,
|
||||
marker::PhantomData,
|
||||
rc::Rc,
|
||||
@@ -280,14 +280,14 @@ pub struct VComponent<'src> {
|
||||
}
|
||||
pub struct Comparator(Box<dyn Fn(&dyn Any) -> bool>);
|
||||
impl std::fmt::Debug for Comparator {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Caller(Box<dyn Fn(Context) -> DomTree>);
|
||||
impl std::fmt::Debug for Caller {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ use crate::nodes::VNode;
|
||||
use bumpalo::Bump;
|
||||
|
||||
use std::{
|
||||
any::{Any, TypeId},
|
||||
any::{Any},
|
||||
cell::RefCell,
|
||||
marker::PhantomData,
|
||||
ops::Deref,
|
||||
@@ -145,7 +145,7 @@ impl<P: Properties + 'static> Scoped for Scope<P> {
|
||||
.expect("Viewing did not happen");
|
||||
}
|
||||
|
||||
fn compare_props(&self, new: &Any) -> bool {
|
||||
fn compare_props(&self, new: &dyn Any) -> bool {
|
||||
new.downcast_ref::<P>()
|
||||
.map(|f| &self.props == f)
|
||||
.expect("Props should not be of a different type")
|
||||
|
||||
@@ -7,16 +7,7 @@ use crate::{
|
||||
};
|
||||
use bumpalo::Bump;
|
||||
use generational_arena::Arena;
|
||||
use std::{
|
||||
any::TypeId,
|
||||
borrow::BorrowMut,
|
||||
cell::{RefCell, UnsafeCell},
|
||||
collections::{vec_deque, VecDeque},
|
||||
future::Future,
|
||||
marker::PhantomData,
|
||||
rc::Rc,
|
||||
sync::atomic::AtomicUsize,
|
||||
};
|
||||
|
||||
|
||||
/// An integrated virtual node system that progresses events and diffs UI trees.
|
||||
/// Differences are converted into patches which a renderer can use to draw the UI.
|
||||
@@ -68,7 +59,7 @@ impl VirtualDom {
|
||||
///
|
||||
/// This is useful when a component tree can be driven by external state (IE SSR) but it would be too expensive
|
||||
/// to toss out the entire tree.
|
||||
pub fn new_with_props<P: Properties + 'static>(root: FC<P>, root_props: P) -> Self {
|
||||
pub fn new_with_props<P: Properties + 'static>(_root: FC<P>, _root_props: P) -> Self {
|
||||
// let mut components = Arena::new();
|
||||
// let mut components = Arena::new();
|
||||
|
||||
@@ -104,7 +95,7 @@ impl VirtualDom {
|
||||
.expect("Root should always exist")
|
||||
.run();
|
||||
|
||||
let b = Bump::new();
|
||||
let _b = Bump::new();
|
||||
|
||||
let mut diff_machine = DiffMachine::new(&self.diff_bump);
|
||||
// let mut diff_machine = DiffMachine::new(self, &self.diff_bump, self.base_scope);
|
||||
@@ -142,7 +133,7 @@ impl VirtualDom {
|
||||
/// }
|
||||
///
|
||||
/// ```
|
||||
pub fn progress_with_event(&mut self, event: EventTrigger) -> Result<EditList<'_>> {
|
||||
pub fn progress_with_event(&mut self, _event: EventTrigger) -> Result<EditList<'_>> {
|
||||
// self.components
|
||||
// .borrow_mut()
|
||||
// .get_mut(event.component_id)
|
||||
|
||||
Reference in new issue
Block a user