Skip to content

[stdsimd] cargo fmt --all succeeds but subsequent cargo fmt --all -- --check fails #2787

Closed
@gnzlbg

Description

@gnzlbg

With this PR cargo fmt --all currently outputs nothing and returns 0 (EXIT_SUCCESS). A subsequent call to cargo fmt --all -- --check returns 101 and sometimes (1/5 times) prints the following diff. Other times it doesn't print anything, just fails with that error (e.g. like here: https://travis-ci.org/rust-lang-nursery/stdsimd/jobs/392688468#L472):

Diff in stdsimd/crates/stdsimd-verify/src/lib.rs at line 95:
 
 fn to_type(t: &syn::Type) -> proc_macro2::TokenStream {
     match *t {
-        syn::Type::Path(ref p) => match extract_path_ident(&p.path).to_string().as_ref() {
-            "__m128" => quote! { &M128 },
-            "__m128d" => quote! { &M128D },
-            "__m128i" => quote! { &M128I },
-            "__m256" => quote! { &M256 },
-            "__m256d" => quote! { &M256D },
-            "__m256i" => quote! { &M256I },
-            "__m64" => quote! { &M64 },
-            "bool" => quote! { &BOOL },
-            "f32" => quote! { &F32 },
-            "f64" => quote! { &F64 },
-            "i16" => quote! { &I16 },
-            "i32" => quote! { &I32 },
-            "i64" => quote! { &I64 },
-            "i8" => quote! { &I8 },
-            "u16" => quote! { &U16 },
-            "u32" => quote! { &U32 },
-            "u64" => quote! { &U64 },
-            "u8" => quote! { &U8 },
-            "CpuidResult" => quote! { &CPUID },
-            s => panic!("unspported type: {}", s),
-        },
+        syn::Type::Path(ref p) => {
+            match extract_path_ident(&p.path).to_string().as_ref() {
+                "__m128" => quote! { &M128 },
+                "__m128d" => quote! { &M128D },
+                "__m128i" => quote! { &M128I },
+                "__m256" => quote! { &M256 },
+                "__m256d" => quote! { &M256D },
+                "__m256i" => quote! { &M256I },
+                "__m64" => quote! { &M64 },
+                "bool" => quote! { &BOOL },
+                "f32" => quote! { &F32 },
+                "f64" => quote! { &F64 },
+                "i16" => quote! { &I16 },
+                "i32" => quote! { &I32 },
+                "i64" => quote! { &I64 },
+                "i8" => quote! { &I8 },
+                "u16" => quote! { &U16 },
+                "u32" => quote! { &U32 },
+                "u64" => quote! { &U64 },
+                "u8" => quote! { &U8 },
+                "CpuidResult" => quote! { &CPUID },
+                s => panic!("unspported type: {}", s),
+            }
+        }
         syn::Type::Ptr(syn::TypePtr { ref elem, .. })
         | syn::Type::Reference(syn::TypeReference { ref elem, .. }) => {
             let tokens = to_type(&elem);

We should add to CI a check that after formatting cargo fmt --all -- --check should return true and if not fail the integration tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPanic, non-idempotency, invalid code, etc.p-high

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions