Browse Source

Clippy nits.

Kestrel 2 years ago
parent
commit
a37f046d0d
2 changed files with 3 additions and 6 deletions
  1. 2 5
      rustructure-macros/src/lib.rs
  2. 1 1
      rustructure/src/lib.rs

+ 2 - 5
rustructure-macros/src/lib.rs

@@ -51,7 +51,7 @@ fn struct_walkable(input: &syn::DeriveInput, ds: &syn::DataStruct) -> TokenStrea
         syn::Fields::Unnamed(u) => fields_walkable(u.unnamed.iter()),
     };
 
-    let ret = quote! {
+    quote! {
         impl ::rustructure::Walkable for #name {
             fn walk_with<W: ::rustructure::Walker>(walker: &mut W) {
                 struct Fields {};
@@ -64,10 +64,7 @@ fn struct_walkable(input: &syn::DeriveInput, ds: &syn::DataStruct) -> TokenStrea
                 walker.visit_struct::<Fields>(#name_str);
             }
         }
-    }
-    .into();
-
-    ret
+    }.into()
 }
 
 fn enum_walkable(input: &syn::DeriveInput, de: &syn::DataEnum) -> TokenStream {

+ 1 - 1
rustructure/src/lib.rs

@@ -56,7 +56,7 @@ mod sw {
             };
             T::walk_with(&mut sw);
             // remove inevitable leading space
-            if sw.buffer.len() > 0 {
+            if !sw.buffer.is_empty() {
                 sw.buffer.remove(0);
             }
             sw.buffer