wip: cargo fix

This commit is contained in:
Jonathan Kelley committed 2021-07-13 16:48:47 -04:00
1 parent 775e9e29b8
commit c7ca7c2273
9 files changed
+67 -68

No files matched your search

+4 -4
View File
@@ -59,8 +59,8 @@ impl SharedArena {
pub fn with_scope<'b, O: 'static>( pub fn with_scope<'b, O: 'static>(
&'b self, &'b self,
id: ScopeIdx, _id: ScopeIdx,
f: impl FnOnce(&'b mut Scope) -> O, _f: impl FnOnce(&'b mut Scope) -> O,
) -> Result<O> { ) -> Result<O> {
todo!() todo!()
} }
@@ -69,8 +69,8 @@ impl SharedArena {
// this is useful for merging lifetimes // this is useful for merging lifetimes
pub fn with_scope_vnode<'b>( pub fn with_scope_vnode<'b>(
&self, &self,
id: ScopeIdx, _id: ScopeIdx,
f: impl FnOnce(&mut Scope) -> &VNode<'b>, _f: impl FnOnce(&mut Scope) -> &VNode<'b>,
) -> Result<&VNode<'b>> { ) -> Result<&VNode<'b>> {
todo!() todo!()
} }
+12 -12
View File
@@ -1,13 +1,13 @@
use crate::hooklist::HookList;
use crate::{arena::SharedArena, innerlude::*}; use crate::{innerlude::*};
use appendlist::AppendList;
use bumpalo::Bump;
use futures_util::{pin_mut, FutureExt}; use futures_util::{FutureExt};
use slotmap::DefaultKey;
use slotmap::SlotMap;
use std::borrow::BorrowMut; use std::borrow::BorrowMut;
use std::marker::PhantomData; use std::marker::PhantomData;
use std::sync::{Arc, RwLock};
use std::{ use std::{
any::{Any, TypeId}, any::{Any, TypeId},
cell::{Cell, RefCell}, cell::{Cell, RefCell},
@@ -137,7 +137,7 @@ impl<'src, P> Context<'src, P> {
self, self,
initializer: Init, initializer: Init,
runner: Run, runner: Run,
cleanup: Cleanup, _cleanup: Cleanup,
) -> Output ) -> Output
where where
State: 'static, State: 'static,
@@ -280,7 +280,7 @@ Any function prefixed with "use" should not be called conditionally.
/// ///
/// ///
/// ///
pub fn submit_task(&self, task: Pin<Box<dyn Future<Output = ()>>>) -> TaskHandle { pub fn submit_task(&self, _task: Pin<Box<dyn Future<Output = ()>>>) -> TaskHandle {
// let r = task.then(|f| async { // let r = task.then(|f| async {
// // // //
// }); // });
@@ -356,8 +356,8 @@ Any function prefixed with "use" should not be called conditionally.
/// ///
pub fn suspend<Out, Fut: 'static>( pub fn suspend<Out, Fut: 'static>(
&'src self, &'src self,
task_initializer: impl FnOnce() -> Fut + 'src, _task_initializer: impl FnOnce() -> Fut + 'src,
callback: impl FnOnce(SuspendedContext, Out) -> VNode<'src> + 'src, _callback: impl FnOnce(SuspendedContext, Out) -> VNode<'src> + 'src,
) -> VNode<'src> ) -> VNode<'src>
where where
Out: 'src, Out: 'src,
+17 -17
View File
@@ -49,7 +49,7 @@
//! - https://hacks.mozilla.org/2019/03/fast-bump-allocated-virtual-doms-with-rust-and-wasm/ //! - https://hacks.mozilla.org/2019/03/fast-bump-allocated-virtual-doms-with-rust-and-wasm/
use crate::{arena::SharedArena, innerlude::*, tasks::TaskQueue}; use crate::{arena::SharedArena, innerlude::*, tasks::TaskQueue};
use fxhash::{FxHashMap, FxHashSet}; use fxhash::{FxHashSet};
use std::any::Any; use std::any::Any;
@@ -360,9 +360,9 @@ where
attributes, attributes,
children, children,
namespace, namespace,
static_attrs, static_attrs: _,
static_children, static_children: _,
static_listeners, static_listeners: _,
} = el; } = el;
let real_id = if let Some(namespace) = namespace { let real_id = if let Some(namespace) = namespace {
@@ -559,7 +559,7 @@ impl<'a, 'bump, Dom: RealDom<'bump>> DiffMachine<'a, 'bump, Dom> {
// if any characteristics changed, remove and then re-add // if any characteristics changed, remove and then re-add
// if nothing changed, then just move on // if nothing changed, then just move on
let event_type = new_l.event; let _event_type = new_l.event;
for old_l in old { for old_l in old {
if new_l.event == old_l.event { if new_l.event == old_l.event {
@@ -821,8 +821,8 @@ impl<'a, 'bump, Dom: RealDom<'bump>> DiffMachine<'a, 'bump, Dom> {
// Upon exit, the change list stack is the same. // Upon exit, the change list stack is the same.
fn diff_keyed_prefix( fn diff_keyed_prefix(
&self, &self,
old: &'bump [VNode<'bump>], _old: &'bump [VNode<'bump>],
new: &'bump [VNode<'bump>], _new: &'bump [VNode<'bump>],
) -> KeyedPrefixResult { ) -> KeyedPrefixResult {
todo!() todo!()
// self.dom.go_down(); // self.dom.go_down();
@@ -910,11 +910,11 @@ impl<'a, 'bump, Dom: RealDom<'bump>> DiffMachine<'a, 'bump, Dom> {
// Upon exit from this function, it will be restored to that same state. // Upon exit from this function, it will be restored to that same state.
fn diff_keyed_middle( fn diff_keyed_middle(
&self, &self,
old: &[VNode<'bump>], _old: &[VNode<'bump>],
mut new: &[VNode<'bump>], _new: &[VNode<'bump>],
shared_prefix_count: usize, _shared_prefix_count: usize,
shared_suffix_count: usize, _shared_suffix_count: usize,
old_shared_suffix_start: usize, _old_shared_suffix_start: usize,
) { ) {
todo!() todo!()
// // Should have already diffed the shared-key prefixes and suffixes. // // Should have already diffed the shared-key prefixes and suffixes.
@@ -1138,9 +1138,9 @@ impl<'a, 'bump, Dom: RealDom<'bump>> DiffMachine<'a, 'bump, Dom> {
// When this function exits, the change list stack remains the same. // When this function exits, the change list stack remains the same.
fn diff_keyed_suffix( fn diff_keyed_suffix(
&self, &self,
old: &[VNode<'bump>], _old: &[VNode<'bump>],
new: &[VNode<'bump>], _new: &[VNode<'bump>],
new_shared_suffix_start: usize, _new_shared_suffix_start: usize,
) { ) {
todo!() todo!()
// debug_assert_eq!(old.len(), new.len()); // debug_assert_eq!(old.len(), new.len());
@@ -1178,7 +1178,7 @@ impl<'a, 'bump, Dom: RealDom<'bump>> DiffMachine<'a, 'bump, Dom> {
// [... parent child] // [... parent child]
// todo!() // todo!()
for (i, (new_child, old_child)) in new.iter().zip(old.iter()).enumerate() { for (_i, (new_child, old_child)) in new.iter().zip(old.iter()).enumerate() {
// [... parent prev_child] // [... parent prev_child]
// self.dom.go_to_sibling(i); // self.dom.go_to_sibling(i);
// [... parent this_child] // [... parent this_child]
@@ -1247,7 +1247,7 @@ impl<'a, 'bump, Dom: RealDom<'bump>> DiffMachine<'a, 'bump, Dom> {
pub fn remove_self_and_next_siblings(&self, old: &[VNode<'bump>]) { pub fn remove_self_and_next_siblings(&self, old: &[VNode<'bump>]) {
// debug_assert!(self.dom.traversal_is_committed()); // debug_assert!(self.dom.traversal_is_committed());
for child in old { for child in old {
if let VNodeKind::Component(vcomp) = child.kind { if let VNodeKind::Component(_vcomp) = child.kind {
// dom // dom
// .create_text_node("placeholder for vcomponent"); // .create_text_node("placeholder for vcomponent");
+1 -1
View File
@@ -4,7 +4,7 @@
//! 3rd party renderers are responsible for converting their native events into these virtual event types. Events might //! 3rd party renderers are responsible for converting their native events into these virtual event types. Events might
//! be heavy or need to interact through FFI, so the events themselves are designed to be lazy. //! be heavy or need to interact through FFI, so the events themselves are designed to be lazy.
use std::{cell::Cell, ops::Deref, rc::Rc};
use crate::innerlude::{RealDomNode, ScopeIdx}; use crate::innerlude::{RealDomNode, ScopeIdx};
+6 -6
View File
@@ -173,10 +173,10 @@ impl<'a> NodeFactory<'a> {
pub fn raw_element( pub fn raw_element(
&self, &self,
tag: &'static str, _tag: &'static str,
listeners: &[Listener], _listeners: &[Listener],
attributes: &[Attribute], _attributes: &[Attribute],
children: &'a [VNode<'a>], _children: &'a [VNode<'a>],
) -> VNode<'a> { ) -> VNode<'a> {
todo!() todo!()
} }
@@ -295,7 +295,7 @@ impl<'a> NodeFactory<'a> {
let res = component(cx); let res = component(cx);
// submit any async tasks to the scope // submit any async tasks to the scope
for task in tasks.borrow_mut().drain(..) { for _task in tasks.borrow_mut().drain(..) {
// scp.submit_task(task); // scp.submit_task(task);
} }
@@ -453,7 +453,7 @@ impl Debug for VNode<'_> {
} }
mod tests { mod tests {
use super::*;
static B1: &str = "hello world!"; static B1: &str = "hello world!";
static B2: &str = "hello world!"; static B2: &str = "hello world!";
+7 -7
View File
@@ -1,11 +1,11 @@
use crate::hooklist::HookList; use crate::hooklist::HookList;
use crate::{arena::SharedArena, innerlude::*}; use crate::{arena::SharedArena, innerlude::*};
use appendlist::AppendList;
use bumpalo::Bump;
use slotmap::DefaultKey;
use slotmap::SlotMap;
use std::marker::PhantomData;
use std::sync::Arc;
use std::{ use std::{
any::{Any, TypeId}, any::{Any, TypeId},
cell::{Cell, RefCell}, cell::{Cell, RefCell},
@@ -182,7 +182,7 @@ impl Scope {
self.arena_idx self.arena_idx
); );
let mut listners = self.listeners.borrow_mut(); let listners = self.listeners.borrow_mut();
// let listener = listners.get(trigger); // let listener = listners.get(trigger);
let raw_listener = listners.iter().find(|(domptr, _)| { let raw_listener = listners.iter().find(|(domptr, _)| {
+4 -4
View File
@@ -16,7 +16,7 @@ use std::{
task::{Context, Poll}, task::{Context, Poll},
}; };
use futures_util::{Future, Stream, StreamExt}; use futures_util::{Future, Stream};
use slotmap::{DefaultKey, SlotMap}; use slotmap::{DefaultKey, SlotMap};
use crate::{events::EventTrigger, innerlude::ScopeIdx}; use crate::{events::EventTrigger, innerlude::ScopeIdx};
@@ -64,19 +64,19 @@ impl Stream for TaskQueue {
/// We can never be finished polling /// We can never be finished polling
fn poll_next( fn poll_next(
mut self: Pin<&mut Self>, self: Pin<&mut Self>,
cx: &mut std::task::Context<'_>, cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> { ) -> std::task::Poll<Option<Self::Item>> {
// let yield_every = self.len(); // let yield_every = self.len();
// let mut polled = 0; // let mut polled = 0;
let mut slots = self.slots.write().unwrap(); let mut slots = self.slots.write().unwrap();
for (key, slot) in slots.iter_mut() { for (_key, slot) in slots.iter_mut() {
if slot.dead.get() { if slot.dead.get() {
continue; continue;
} }
let r = slot.fut; let r = slot.fut;
let mut fut = unsafe { &mut *r }; let fut = unsafe { &mut *r };
// use futures::{future::Future, poll, FutureExt}; // use futures::{future::Future, poll, FutureExt};
let f2 = fut.as_mut(); let f2 = fut.as_mut();
+13 -14
View File
@@ -1,7 +1,6 @@
use std::{ use std::{
cell::{Cell, RefCell, RefMut}, cell::{Cell, RefCell, RefMut},
rc::Rc, rc::Rc,
vec::Drain,
}; };
use futures_util::StreamExt; use futures_util::StreamExt;
@@ -89,23 +88,23 @@ impl DebugDom {
} }
} }
impl<'a> RealDom<'a> for DebugDom { impl<'a> RealDom<'a> for DebugDom {
fn push(&mut self, root: RealDomNode) {} fn push(&mut self, _root: RealDomNode) {}
fn pop(&mut self) {} fn pop(&mut self) {}
fn append_children(&mut self, many: u32) {} fn append_children(&mut self, _many: u32) {}
fn replace_with(&mut self, many: u32) {} fn replace_with(&mut self, _many: u32) {}
fn remove(&mut self) {} fn remove(&mut self) {}
fn remove_all_children(&mut self) {} fn remove_all_children(&mut self) {}
fn create_text_node(&mut self, text: &str) -> RealDomNode { fn create_text_node(&mut self, _text: &str) -> RealDomNode {
self.counter += 1; self.counter += 1;
RealDomNode::new(self.counter) RealDomNode::new(self.counter)
} }
fn create_element(&mut self, tag: &str, ns: Option<&'a str>) -> RealDomNode { fn create_element(&mut self, _tag: &str, _ns: Option<&'a str>) -> RealDomNode {
self.counter += 1; self.counter += 1;
RealDomNode::new(self.counter) RealDomNode::new(self.counter)
} }
@@ -117,20 +116,20 @@ impl<'a> RealDom<'a> for DebugDom {
fn new_event_listener( fn new_event_listener(
&mut self, &mut self,
event: &str, _event: &str,
scope: ScopeIdx, _scope: ScopeIdx,
element_id: usize, _element_id: usize,
realnode: RealDomNode, _realnode: RealDomNode,
) { ) {
} }
fn remove_event_listener(&mut self, event: &str) {} fn remove_event_listener(&mut self, _event: &str) {}
fn set_text(&mut self, text: &str) {} fn set_text(&mut self, _text: &str) {}
fn set_attribute(&mut self, name: &str, value: &str, namespace: Option<&str>) {} fn set_attribute(&mut self, _name: &str, _value: &str, _namespace: Option<&str>) {}
fn remove_attribute(&mut self, name: &str) {} fn remove_attribute(&mut self, _name: &str) {}
fn raw_node_as_any_mut(&self) -> &mut dyn std::any::Any { fn raw_node_as_any_mut(&self) -> &mut dyn std::any::Any {
todo!() todo!()
+3 -3
View File
@@ -21,13 +21,13 @@
use crate::tasks::TaskQueue; use crate::tasks::TaskQueue;
use crate::{arena::SharedArena, innerlude::*}; use crate::{arena::SharedArena, innerlude::*};
use appendlist::AppendList;
use slotmap::DefaultKey; use slotmap::DefaultKey;
use slotmap::SlotMap; use slotmap::SlotMap;
use std::any::Any; use std::any::Any;
use std::cell::RefCell;
use std::pin::Pin; use std::pin::Pin;
use std::{any::TypeId, fmt::Debug, rc::Rc}; use std::{any::TypeId};
pub type ScopeIdx = DefaultKey; pub type ScopeIdx = DefaultKey;