Explorar el Código

fix formatting

Evan Almloff hace 2 años
padre
commit
03413a68ab
Se han modificado 3 ficheros con 13 adiciones y 13 borrados
  1. 0 2
      examples/web_component.rs
  2. 10 8
      packages/rsx/src/element.rs
  3. 3 3
      packages/rsx/src/lib.rs

+ 0 - 2
examples/web_component.rs

@@ -1,5 +1,3 @@
-
-
 use dioxus::prelude::*;
 
 fn main() {

+ 10 - 8
packages/rsx/src/element.rs

@@ -233,7 +233,11 @@ impl Parse for ElementName {
         if raw.len() == 1 {
             Ok(ElementName::Ident(raw.into_iter().next().unwrap()))
         } else {
-            let tag = raw.into_iter().map(|ident| ident.to_string()).collect::<Vec<_>>().join("-");
+            let tag = raw
+                .into_iter()
+                .map(|ident| ident.to_string())
+                .collect::<Vec<_>>()
+                .join("-");
             Ok(ElementName::Custom(tag))
         }
     }
@@ -307,21 +311,19 @@ impl ToTokens for ElementAttrNamed {
             ElementName::Ident(_) => quote! { #el_name::#name.2 },
             ElementName::Custom(_) => quote! { false },
         };
-        let attribute=|name: &Ident| match el_name{
+        let attribute = |name: &Ident| match el_name {
             ElementName::Ident(_) => quote! { #el_name::#name.0 },
             ElementName::Custom(_) => {
-                let as_string=name.to_string();
+                let as_string = name.to_string();
                 quote!(#as_string)
             }
         };
 
-        let attribute=
-
-        match attr {
+        let attribute = match attr {
             ElementAttr::AttrText { name, value } => {
                 let ns = ns(name);
                 let volitile = volitile(name);
-                let attribute=attribute(name);
+                let attribute = attribute(name);
                 quote! {
                     __cx.attr(
                         #attribute,
@@ -334,7 +336,7 @@ impl ToTokens for ElementAttrNamed {
             ElementAttr::AttrExpression { name, value } => {
                 let ns = ns(name);
                 let volitile = volitile(name);
-                let attribute=attribute(name);
+                let attribute = attribute(name);
                 quote! {
                     __cx.attr(
                         #attribute,

+ 3 - 3
packages/rsx/src/lib.rs

@@ -434,12 +434,12 @@ impl<'a> DynamicContext<'a> {
                     ElementAttr::AttrText { name, value } if value.is_static() => {
                         let value = value.to_static().unwrap();
                         let ns = ns(quote!(#name.1));
-                        let name=match el_name {
+                        let name = match el_name {
                             ElementName::Ident(_) => quote! { #el_name::#name.0 },
                             ElementName::Custom(_) => {
-                                let as_string=name.to_string();
+                                let as_string = name.to_string();
                                 quote! { #as_string }
-                            },
+                            }
                         };
                         quote! {
                             ::dioxus::core::TemplateAttribute::Static {