about summary refs log tree commit diff
path: root/library/stdarch/crates/assert-instr-macro
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-12-13 17:26:22 -0600
committerGitHub <noreply@github.com>2018-12-13 17:26:22 -0600
commit5a45175fe150d49347d665a0716e842ab3c60bcc (patch)
tree1802da50fc461b22cea7b5fe7e9c3bf6100d65cc /library/stdarch/crates/assert-instr-macro
parent80a3099792351411e7024e26743ea98887477fb6 (diff)
downloadrust-5a45175fe150d49347d665a0716e842ab3c60bcc.tar.gz
rust-5a45175fe150d49347d665a0716e842ab3c60bcc.zip
Run rustfmt on stable, delete rustfmt.toml (#619)
This commit switches CI to running `rustfmt` on the stable compiler (as
rustfmt is stable now!). Additionally it deletes `rustfmt.toml` to
ensure we're following the same style as the rest of the ecosystem.
Diffstat (limited to 'library/stdarch/crates/assert-instr-macro')
-rw-r--r--library/stdarch/crates/assert-instr-macro/src/lib.rs23
1 files changed, 8 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 b6375154f5f..43a8b8a7e62 100644
--- a/library/stdarch/crates/assert-instr-macro/src/lib.rs
+++ b/library/stdarch/crates/assert-instr-macro/src/lib.rs
@@ -19,12 +19,11 @@ use quote::ToTokens;
 
 #[proc_macro_attribute]
 pub fn assert_instr(
-    attr: proc_macro::TokenStream, item: proc_macro::TokenStream,
+    attr: proc_macro::TokenStream,
+    item: proc_macro::TokenStream,
 ) -> proc_macro::TokenStream {
-    let invoc = syn::parse::<Invoc>(attr)
-        .expect("expected #[assert_instr(instr, a = b, ...)]");
-    let item =
-        syn::parse::<syn::Item>(item).expect("must be attached to an item");
+    let invoc = syn::parse::<Invoc>(attr).expect("expected #[assert_instr(instr, a = b, ...)]");
+    let item = syn::parse::<syn::Item>(item).expect("must be attached to an item");
     let func = match item {
         syn::Item::Fn(ref f) => f,
         _ => panic!("must be attached to a function"),
@@ -36,16 +35,12 @@ pub fn assert_instr(
     // Disable assert_instr for x86 targets compiled with avx enabled, which
     // causes LLVM to generate different intrinsics that the ones we are
     // testing for.
-    let disable_assert_instr =
-        std::env::var("STDSIMD_DISABLE_ASSERT_INSTR").is_ok();
+    let disable_assert_instr = std::env::var("STDSIMD_DISABLE_ASSERT_INSTR").is_ok();
 
     let instr_str = instr
         .replace('.', "_")
         .replace(|c: char| c.is_whitespace(), "");
-    let assert_name = syn::Ident::new(
-        &format!("assert_{}_{}", name, instr_str),
-        name.span(),
-    );
+    let assert_name = syn::Ident::new(&format!("assert_{}_{}", name, instr_str), name.span());
     let shim_name = syn::Ident::new(&format!("{}_shim", name), name.span());
     let mut inputs = Vec::new();
     let mut input_vals = Vec::new();
@@ -62,8 +57,7 @@ pub fn assert_instr(
             syn::Pat::Ident(ref i) => &i.ident,
             _ => panic!("must have bare arguments"),
         };
-        if let Some(&(_, ref tts)) = invoc.args.iter().find(|a| *ident == a.0)
-        {
+        if let Some(&(_, ref tts)) = invoc.args.iter().find(|a| *ident == a.0) {
             input_vals.push(quote! { #tts });
         } else {
             inputs.push(capture);
@@ -133,8 +127,7 @@ pub fn assert_instr(
         }
     };
     // why? necessary now to get tests to work?
-    let tts: TokenStream =
-        tts.to_string().parse().expect("cannot parse tokenstream");
+    let tts: TokenStream = tts.to_string().parse().expect("cannot parse tokenstream");
 
     let tts: TokenStream = quote! {
         #item