Evan Almloff 1 سال پیش
والد
کامیت
46fec1ae48
3فایلهای تغییر یافته به همراه3 افزوده شده و 5 حذف شده
  1. 1 3
      packages/core-macro/src/props/mod.rs
  2. 1 1
      packages/core/src/diff.rs
  3. 1 1
      packages/rsx/src/lib.rs

+ 1 - 3
packages/core-macro/src/props/mod.rs

@@ -936,9 +936,7 @@ Finally, call `.build()` to create the instance of `{name}`.
 
         pub fn field_impl(&self, field: &FieldInfo) -> Result<TokenStream, Error> {
             let FieldInfo {
-                name: field_name,
-                ty: field_type,
-                ..
+                name: field_name, ..
             } = field;
             if *field_name == "key" {
                 return Err(Error::new_spanned(field_name, "Naming a prop `key` is not allowed because the name can conflict with the built in key attribute. See https://dioxuslabs.com/learn/0.4/reference/dynamic_rendering#rendering-lists for more information about keys"));

+ 1 - 1
packages/core/src/diff.rs

@@ -626,7 +626,7 @@ impl<'b> VirtualDom {
         // If none of the old keys are reused by the new children, then we remove all the remaining old children and
         // create the new children afresh.
         if shared_keys.is_empty() {
-            if old.get(0).is_some() {
+            if !old.is_empty() {
                 self.remove_nodes(&old[1..]);
                 self.replace(&old[0], new);
             } else {

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

@@ -195,7 +195,7 @@ impl<'a> ToTokens for TemplateRenderer<'a> {
     fn to_tokens(&self, out_tokens: &mut TokenStream2) {
         let mut context = DynamicContext::default();
 
-        let key = match self.roots.get(0) {
+        let key = match self.roots.first() {
             Some(BodyNode::Element(el)) if self.roots.len() == 1 => el.key.clone(),
             Some(BodyNode::Component(comp)) if self.roots.len() == 1 => comp.key().cloned(),
             _ => None,