about summary refs log tree commit diff
path: root/library/stdarch/crates/assert-instr-macro/src
diff options
context:
space:
mode:
authorgnzlbg <gonzalobg88@gmail.com>2018-11-10 15:45:16 +0100
committergnzlbg <gnzlbg@users.noreply.github.com>2018-11-11 12:37:44 +0100
commiteee3d5e6f0d69eeba64154421ae8fd5eeb9f2b38 (patch)
treef9434cb5857ef5d61ecc949ec7a327663406b304 /library/stdarch/crates/assert-instr-macro/src
parentf31a104c1c64c41fbabd6d461a22e6a1755b813a (diff)
downloadrust-eee3d5e6f0d69eeba64154421ae8fd5eeb9f2b38.tar.gz
rust-eee3d5e6f0d69eeba64154421ae8fd5eeb9f2b38.zip
fix clippy and shellcheck issues
Diffstat (limited to 'library/stdarch/crates/assert-instr-macro/src')
-rw-r--r--library/stdarch/crates/assert-instr-macro/src/lib.rs26
1 files changed, 11 insertions, 15 deletions
diff --git a/library/stdarch/crates/assert-instr-macro/src/lib.rs b/library/stdarch/crates/assert-instr-macro/src/lib.rs
index 7939fccb7ff..b6375154f5f 100644
--- a/library/stdarch/crates/assert-instr-macro/src/lib.rs
+++ b/library/stdarch/crates/assert-instr-macro/src/lib.rs
@@ -15,6 +15,7 @@ extern crate quote;
 extern crate syn;
 
 use proc_macro2::TokenStream;
+use quote::ToTokens;
 
 #[proc_macro_attribute]
 pub fn assert_instr(
@@ -38,7 +39,6 @@ pub fn assert_instr(
     let disable_assert_instr =
         std::env::var("STDSIMD_DISABLE_ASSERT_INSTR").is_ok();
 
-    use quote::ToTokens;
     let instr_str = instr
         .replace('.', "_")
         .replace(|c: char| c.is_whitespace(), "");
@@ -62,15 +62,13 @@ pub fn assert_instr(
             syn::Pat::Ident(ref i) => &i.ident,
             _ => panic!("must have bare arguments"),
         };
-        match invoc.args.iter().find(|a| *ident == a.0) {
-            Some(&(_, ref tts)) => {
-                input_vals.push(quote! { #tts });
-            }
-            None => {
-                inputs.push(capture);
-                input_vals.push(quote! { #ident });
-            }
-        };
+        if let Some(&(_, ref tts)) = invoc.args.iter().find(|a| *ident == a.0)
+        {
+            input_vals.push(quote! { #tts });
+        } else {
+            inputs.push(capture);
+            input_vals.push(quote! { #ident });
+        }
     }
 
     let attrs = func
@@ -133,8 +131,7 @@ pub fn assert_instr(
                                    stringify!(#shim_name),
                                    #instr);
         }
-    }
-    .into();
+    };
     // why? necessary now to get tests to work?
     let tts: TokenStream =
         tts.to_string().parse().expect("cannot parse tokenstream");
@@ -142,8 +139,7 @@ pub fn assert_instr(
     let tts: TokenStream = quote! {
         #item
         #tts
-    }
-    .into();
+    };
     tts.into()
 }
 
@@ -167,7 +163,7 @@ impl syn::parse::Parse for Invoc {
             let expr = input.parse::<syn::Expr>()?;
             args.push((name, expr));
         }
-        Ok(Invoc { instr, args })
+        Ok(Self { instr, args })
     }
 }