chore: make clippy happy

This commit is contained in:
Jonathan Kelley committed 2022-12-06 17:44:29 -08:00
1 parent 34d9aafe0e
commit 5a0ae67ccb
7 files changed
+29 -21

No files matched your search

+3 -3
View File
@@ -96,9 +96,9 @@ impl VirtualDom {
node.clear_listeners(); node.clear_listeners();
node.dynamic_nodes.iter().for_each(|node| match node { node.dynamic_nodes.iter().for_each(|node| match node {
DynamicNode::Component(c) => self.drop_scope(c.scope.get().unwrap()), DynamicNode::Component(c) => self.drop_scope(c.scope.get().unwrap()),
DynamicNode::Fragment(nodes) => nodes DynamicNode::Fragment(nodes) => {
.into_iter() nodes.iter().for_each(|node| self.drop_scope_inner(node))
.for_each(|node| self.drop_scope_inner(node)), }
DynamicNode::Placeholder(t) => { DynamicNode::Placeholder(t) => {
self.try_reclaim(t.get()); self.try_reclaim(t.get());
} }
+2 -6
View File
@@ -52,12 +52,8 @@ impl<'b> VirtualDom {
self.scope_stack.pop(); self.scope_stack.pop();
} }
fn diff_ok_to_err(&mut self, _l: &'b VNode<'b>, _e: &anyhow::Error) { fn diff_ok_to_err(&mut self, _l: &'b VNode<'b>, _e: &anyhow::Error) {}
return; fn diff_err_to_ok(&mut self, _e: &anyhow::Error, _l: &'b VNode<'b>) {}
}
fn diff_err_to_ok(&mut self, _e: &anyhow::Error, _l: &'b VNode<'b>) {
return;
}
fn diff_node(&mut self, left_template: &'b VNode<'b>, right_template: &'b VNode<'b>) { fn diff_node(&mut self, left_template: &'b VNode<'b>, right_template: &'b VNode<'b>) {
if left_template.template.name != right_template.template.name { if left_template.template.name != right_template.template.name {
+2 -2
View File
@@ -29,8 +29,8 @@ use crate::innerlude::*;
pub fn Fragment<'a>(cx: Scope<'a, FragmentProps<'a>>) -> Element { pub fn Fragment<'a>(cx: Scope<'a, FragmentProps<'a>>) -> Element {
let children = cx.props.0.as_ref().map_err(|e| anyhow::anyhow!("{}", e))?; let children = cx.props.0.as_ref().map_err(|e| anyhow::anyhow!("{}", e))?;
Ok(VNode { Ok(VNode {
key: children.key.clone(), key: children.key,
parent: children.parent.clone(), parent: children.parent,
template: children.template, template: children.template,
root_ids: children.root_ids, root_ids: children.root_ids,
dynamic_nodes: children.dynamic_nodes, dynamic_nodes: children.dynamic_nodes,
+1 -1
View File
@@ -34,7 +34,7 @@ impl VirtualDom {
} }
} }
pub(crate) fn acquire_suspense_boundary<'a>(&'a self, id: ScopeId) -> Rc<SuspenseContext> { pub(crate) fn acquire_suspense_boundary(&self, id: ScopeId) -> Rc<SuspenseContext> {
self.scopes[id.0] self.scopes[id.0]
.consume_context::<Rc<SuspenseContext>>() .consume_context::<Rc<SuspenseContext>>()
.unwrap() .unwrap()
+2 -2
View File
@@ -530,11 +530,11 @@ impl VirtualDom {
self.mutations self.mutations
.templates .templates
.extend(context.mutations.borrow_mut().templates.drain(..)); .append(&mut context.mutations.borrow_mut().templates);
self.mutations self.mutations
.edits .edits
.extend(context.mutations.borrow_mut().edits.drain(..)); .append(&mut context.mutations.borrow_mut().edits);
// TODO: count how many nodes are on the stack? // TODO: count how many nodes are on the stack?
self.mutations.push(Mutation::ReplaceWith { self.mutations.push(Mutation::ReplaceWith {
+18 -6
View File
@@ -70,7 +70,7 @@ impl StringCache {
} }
} }
} }
if children.len() == 0 && tag_is_self_closing(tag) { if children.is_empty() && tag_is_self_closing(tag) {
write!(chain, "/>")?; write!(chain, "/>")?;
} else { } else {
write!(chain, ">")?; write!(chain, ">")?;
@@ -92,9 +92,21 @@ impl StringCache {
} }
fn tag_is_self_closing(tag: &str) -> bool { fn tag_is_self_closing(tag: &str) -> bool {
match tag { matches!(
"area" | "base" | "br" | "col" | "embed" | "hr" | "img" | "input" | "link" | "meta" tag,
| "param" | "source" | "track" | "wbr" => true, "area"
_ => false, | "base"
} | "br"
| "col"
| "embed"
| "hr"
| "img"
| "input"
| "link"
| "meta"
| "param"
| "source"
| "track"
| "wbr"
)
} }
+1 -1
View File
@@ -12,7 +12,7 @@ use crate::renderer::Renderer;
/// A convenience function to render an `rsx!` call to a string /// A convenience function to render an `rsx!` call to a string
/// ///
/// For advanced rendering, create a new `SsrRender`. /// For advanced rendering, create a new `SsrRender`.
pub fn render_lazy<'a, 'b>(f: LazyNodes<'a, 'b>) -> String { pub fn render_lazy(f: LazyNodes<'_, '_>) -> String {
// We need to somehow get the lazy call into the virtualdom even with the lifetime // We need to somehow get the lazy call into the virtualdom even with the lifetime
// Since the lazy lifetime is valid for this function, we can just transmute it to static temporarily // Since the lazy lifetime is valid for this function, we can just transmute it to static temporarily
// This is okay since we're returning an owned value // This is okay since we're returning an owned value