@@ -9,7 +9,7 @@ use syn::{
99 parse:: { Parse , ParseStream } ,
1010 parse_macro_input,
1111 spanned:: Spanned ,
12- Expr , Ident , DeriveInput , Data , Token , Variant ,
12+ Data , DeriveInput , Expr , Ident , Token , Variant ,
1313} ;
1414
1515struct Flag < ' a > {
@@ -249,18 +249,24 @@ fn gen_enumflags(ast: &mut DeriveInput, default: Vec<Ident>) -> Result<TokenStre
249249 let ast_variants = match & mut ast. data {
250250 Data :: Enum ( ref mut data) => & mut data. variants ,
251251 Data :: Struct ( data) => {
252- return Err ( syn:: Error :: new_spanned ( & data. struct_token ,
253- "expected enum for #[bitflags], found struct" ) ) ;
252+ return Err ( syn:: Error :: new_spanned (
253+ & data. struct_token ,
254+ "expected enum for #[bitflags], found struct" ,
255+ ) ) ;
254256 }
255257 Data :: Union ( data) => {
256- return Err ( syn:: Error :: new_spanned ( & data. union_token ,
257- "expected enum for #[bitflags], found union" ) ) ;
258+ return Err ( syn:: Error :: new_spanned (
259+ & data. union_token ,
260+ "expected enum for #[bitflags], found union" ,
261+ ) ) ;
258262 }
259263 } ;
260264
261265 if ast. generics . lt_token . is_some ( ) || ast. generics . where_clause . is_some ( ) {
262- return Err ( syn:: Error :: new_spanned ( & ast. generics ,
263- "bitflags cannot be generic" ) ) ;
266+ return Err ( syn:: Error :: new_spanned (
267+ & ast. generics ,
268+ "bitflags cannot be generic" ,
269+ ) ) ;
264270 }
265271
266272 let repr = extract_repr ( & ast. attrs ) ?
@@ -334,18 +340,18 @@ fn gen_enumflags(ast: &mut DeriveInput, default: Vec<Ident>) -> Result<TokenStre
334340 unsafe impl :: enumflags2:: _internal:: RawBitFlags for #ident {
335341 type Numeric = #repr;
336342
337- const EMPTY : Self :: Numeric = 0 ;
343+ const EMPTY : < Self as :: enumflags2 :: _internal :: RawBitFlags > :: Numeric = 0 ;
338344
339- const DEFAULT : Self :: Numeric =
345+ const DEFAULT : < Self as :: enumflags2 :: _internal :: RawBitFlags > :: Numeric =
340346 0 #( | ( Self :: #default as #repr) ) * ;
341347
342- const ALL_BITS : Self :: Numeric =
348+ const ALL_BITS : < Self as :: enumflags2 :: _internal :: RawBitFlags > :: Numeric =
343349 0 #( | ( Self :: #variant_names as #repr) ) * ;
344350
345351 const BITFLAGS_TYPE_NAME : & ' static str =
346352 concat!( "BitFlags<" , stringify!( #ident) , ">" ) ;
347353
348- fn bits( self ) -> Self :: Numeric {
354+ fn bits( self ) -> < Self as :: enumflags2 :: _internal :: RawBitFlags > :: Numeric {
349355 self as #repr
350356 }
351357 }
0 commit comments