@@ -83,8 +83,7 @@ pub fn x86_functions(input: TokenStream) -> TokenStream {
83
83
required_const: & [ #( #required_const) , * ] ,
84
84
}
85
85
}
86
- } )
87
- . collect :: < Vec < _ > > ( ) ;
86
+ } ) . collect :: < Vec < _ > > ( ) ;
88
87
89
88
let ret = quote ! { #input: & [ Function ] = & [ #( #functions) , * ] ; } ;
90
89
// println!("{}", ret);
@@ -93,28 +92,30 @@ pub fn x86_functions(input: TokenStream) -> TokenStream {
93
92
94
93
fn to_type ( t : & syn:: Type ) -> proc_macro2:: TokenStream {
95
94
match * t {
96
- syn:: Type :: Path ( ref p) => match extract_path_ident ( & p. path ) . to_string ( ) . as_ref ( ) {
97
- "__m128" => quote ! { & M128 } ,
98
- "__m128d" => quote ! { & M128D } ,
99
- "__m128i" => quote ! { & M128I } ,
100
- "__m256" => quote ! { & M256 } ,
101
- "__m256d" => quote ! { & M256D } ,
102
- "__m256i" => quote ! { & M256I } ,
103
- "__m64" => quote ! { & M64 } ,
104
- "bool" => quote ! { & BOOL } ,
105
- "f32" => quote ! { & F32 } ,
106
- "f64" => quote ! { & F64 } ,
107
- "i16" => quote ! { & I16 } ,
108
- "i32" => quote ! { & I32 } ,
109
- "i64" => quote ! { & I64 } ,
110
- "i8" => quote ! { & I8 } ,
111
- "u16" => quote ! { & U16 } ,
112
- "u32" => quote ! { & U32 } ,
113
- "u64" => quote ! { & U64 } ,
114
- "u8" => quote ! { & U8 } ,
115
- "CpuidResult" => quote ! { & CPUID } ,
116
- s => panic ! ( "unspported type: {}" , s) ,
117
- } ,
95
+ syn:: Type :: Path ( ref p) => {
96
+ match extract_path_ident ( & p. path ) . to_string ( ) . as_ref ( ) {
97
+ "__m128" => quote ! { & M128 } ,
98
+ "__m128d" => quote ! { & M128D } ,
99
+ "__m128i" => quote ! { & M128I } ,
100
+ "__m256" => quote ! { & M256 } ,
101
+ "__m256d" => quote ! { & M256D } ,
102
+ "__m256i" => quote ! { & M256I } ,
103
+ "__m64" => quote ! { & M64 } ,
104
+ "bool" => quote ! { & BOOL } ,
105
+ "f32" => quote ! { & F32 } ,
106
+ "f64" => quote ! { & F64 } ,
107
+ "i16" => quote ! { & I16 } ,
108
+ "i32" => quote ! { & I32 } ,
109
+ "i64" => quote ! { & I64 } ,
110
+ "i8" => quote ! { & I8 } ,
111
+ "u16" => quote ! { & U16 } ,
112
+ "u32" => quote ! { & U32 } ,
113
+ "u64" => quote ! { & U64 } ,
114
+ "u8" => quote ! { & U8 } ,
115
+ "CpuidResult" => quote ! { & CPUID } ,
116
+ s => panic ! ( "unspported type: {}" , s) ,
117
+ }
118
+ }
118
119
syn:: Type :: Ptr ( syn:: TypePtr { ref elem, .. } )
119
120
| syn:: Type :: Reference ( syn:: TypeReference { ref elem, .. } ) => {
120
121
let tokens = to_type ( & elem) ;
@@ -183,8 +184,7 @@ fn find_instrs(attrs: &[syn::Attribute]) -> Vec<syn::Ident> {
183
184
}
184
185
}
185
186
_ => None ,
186
- } )
187
- . filter_map ( |nested| match nested {
187
+ } ) . filter_map ( |nested| match nested {
188
188
syn:: NestedMeta :: Meta ( syn:: Meta :: List ( i) ) => {
189
189
if i. ident == "assert_instr" {
190
190
i. nested . into_iter ( ) . next ( )
@@ -193,12 +193,10 @@ fn find_instrs(attrs: &[syn::Attribute]) -> Vec<syn::Ident> {
193
193
}
194
194
}
195
195
_ => None ,
196
- } )
197
- . filter_map ( |nested| match nested {
196
+ } ) . filter_map ( |nested| match nested {
198
197
syn:: NestedMeta :: Meta ( syn:: Meta :: Word ( i) ) => Some ( i) ,
199
198
_ => None ,
200
- } )
201
- . collect ( )
199
+ } ) . collect ( )
202
200
}
203
201
204
202
fn find_target_feature ( attrs : & [ syn:: Attribute ] ) -> Option < syn:: Lit > {
@@ -214,13 +212,11 @@ fn find_target_feature(attrs: &[syn::Attribute]) -> Option<syn::Lit> {
214
212
}
215
213
}
216
214
_ => None ,
217
- } )
218
- . flat_map ( |list| list)
215
+ } ) . flat_map ( |list| list)
219
216
. filter_map ( |nested| match nested {
220
217
syn:: NestedMeta :: Meta ( m) => Some ( m) ,
221
218
syn:: NestedMeta :: Literal ( _) => None ,
222
- } )
223
- . filter_map ( |m| match m {
219
+ } ) . filter_map ( |m| match m {
224
220
syn:: Meta :: NameValue ( i) => {
225
221
if i. ident == "enable" {
226
222
Some ( i. lit )
@@ -229,8 +225,7 @@ fn find_target_feature(attrs: &[syn::Attribute]) -> Option<syn::Lit> {
229
225
}
230
226
}
231
227
_ => None ,
232
- } )
233
- . next ( )
228
+ } ) . next ( )
234
229
}
235
230
236
231
fn find_required_const ( attrs : & [ syn:: Attribute ] ) -> Vec < usize > {
0 commit comments