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.
This commit is contained in:
Alex Crichton
2018-12-13 17:26:22 -06:00
committed by GitHub
parent 80a3099792
commit 5a45175fe1
34 changed files with 920 additions and 1502 deletions

View File

@@ -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