chore: clean up the repo some

This commit is contained in:
Jonathan Kelley committed 2022-12-06 17:50:25 -08:00
1 parent 5a0ae67ccb
commit 5673017def
13 files changed
+30 -27

No files matched your search

+1 -1
View File
@@ -60,7 +60,7 @@ impl Component {
match self
.fields
.iter()
.find(|f| f.name.to_string() == "key")
.find(|f| f.name == "key")
.map(|f| &f.content)
{
Some(ContentField::Formatted(fmt)) => Some(fmt),
+1 -4
View File
@@ -21,10 +21,7 @@ pub struct IfmtInput {
impl IfmtInput {
pub fn is_static(&self) -> bool {
match self.segments.as_slice() {
&[Segment::Literal(_)] => true,
_ => false,
}
matches!(self.segments.as_slice(), &[Segment::Literal(_)])
}
}
+6 -6
View File
@@ -180,10 +180,10 @@ impl<'a> DynamicContext<'a> {
// [0, 2]
// [0, 2, 1]
let static_attrs = el.attributes.iter().filter_map(|attr| match &attr.attr {
let static_attrs = el.attributes.iter().map(|attr| match &attr.attr {
ElementAttr::AttrText { name, value } if value.is_static() => {
let value = value.source.as_ref().unwrap();
Some(quote! {
quote! {
::dioxus::core::TemplateAttribute::Static {
name: dioxus_elements::#el_name::#name.0,
namespace: dioxus_elements::#el_name::#name.1,
@@ -192,12 +192,12 @@ impl<'a> DynamicContext<'a> {
// todo: we don't diff these so we never apply the volatile flag
// volatile: dioxus_elements::#el_name::#name.2,
}
})
}
}
ElementAttr::CustomAttrText { name, value } if value.is_static() => {
let value = value.source.as_ref().unwrap();
Some(quote! {
quote! {
::dioxus::core::TemplateAttribute::Static {
name: dioxus_elements::#el_name::#name.0,
namespace: dioxus_elements::#el_name::#name.1,
@@ -206,7 +206,7 @@ impl<'a> DynamicContext<'a> {
// todo: we don't diff these so we never apply the volatile flag
// volatile: dioxus_elements::#el_name::#name.2,
}
})
}
}
ElementAttr::AttrExpression { .. }
@@ -217,7 +217,7 @@ impl<'a> DynamicContext<'a> {
let ct = self.dynamic_attributes.len();
self.dynamic_attributes.push(attr);
self.attr_paths.push(self.current_path.clone());
Some(quote! { ::dioxus::core::TemplateAttribute::Dynamic { id: #ct } })
quote! { ::dioxus::core::TemplateAttribute::Dynamic { id: #ct } }
}
});
+1 -1
View File
@@ -141,7 +141,7 @@ impl ToTokens for BodyNode {
pat, expr, body, ..
} = exp;
let renderer = TemplateRenderer { roots: &body };
let renderer = TemplateRenderer { roots: body };
tokens.append_all(quote! {
__cx.make_node(