@@ -293,45 +293,46 @@ fn gen_enumflags(ast: &mut ItemEnum, default: Vec<Ident>) -> Result<TokenStream,
293293 ) ) ;
294294 }
295295
296- let std_path = quote_spanned ! ( span => :: enumflags2:: _internal:: core) ;
296+ let std = quote_spanned ! ( span => :: enumflags2:: _internal:: core) ;
297297 let variant_names = ast. variants . iter ( ) . map ( |v| & v. ident ) . collect :: < Vec < _ > > ( ) ;
298298
299299 Ok ( quote_spanned ! {
300300 span =>
301301 #ast
302302 #( #deferred) *
303- impl #std_path :: ops:: Not for #ident {
303+ impl #std :: ops:: Not for #ident {
304304 type Output = :: enumflags2:: BitFlags <Self >;
305305 #[ inline( always) ]
306306 fn not( self ) -> Self :: Output {
307- use :: enumflags2:: { BitFlags , _internal :: RawBitFlags } ;
308- unsafe { BitFlags :: from_bits_unchecked ( self . bits ( ) ) . not( ) }
307+ use :: enumflags2:: BitFlags ;
308+ BitFlags :: from_flag ( self ) . not( )
309309 }
310310 }
311311
312- impl #std_path :: ops:: BitOr for #ident {
312+ impl #std :: ops:: BitOr for #ident {
313313 type Output = :: enumflags2:: BitFlags <Self >;
314314 #[ inline( always) ]
315315 fn bitor( self , other: Self ) -> Self :: Output {
316- use :: enumflags2:: { BitFlags , _internal :: RawBitFlags } ;
317- unsafe { BitFlags :: from_bits_unchecked ( self . bits ( ) | other. bits ( ) ) }
316+ use :: enumflags2:: BitFlags ;
317+ BitFlags :: from_flag ( self ) | other
318318 }
319319 }
320320
321- impl #std_path :: ops:: BitAnd for #ident {
321+ impl #std :: ops:: BitAnd for #ident {
322322 type Output = :: enumflags2:: BitFlags <Self >;
323323 #[ inline( always) ]
324324 fn bitand( self , other: Self ) -> Self :: Output {
325- use :: enumflags2:: { BitFlags , _internal :: RawBitFlags } ;
326- unsafe { BitFlags :: from_bits_unchecked ( self . bits ( ) & other. bits ( ) ) }
325+ use :: enumflags2:: BitFlags ;
326+ BitFlags :: from_flag ( self ) & other
327327 }
328328 }
329329
330- impl #std_path :: ops:: BitXor for #ident {
330+ impl #std :: ops:: BitXor for #ident {
331331 type Output = :: enumflags2:: BitFlags <Self >;
332332 #[ inline( always) ]
333333 fn bitxor( self , other: Self ) -> Self :: Output {
334- #std_path:: convert:: Into :: <Self :: Output >:: into( self ) ^ #std_path:: convert:: Into :: <Self :: Output >:: into( other)
334+ use :: enumflags2:: BitFlags ;
335+ BitFlags :: from_flag( self ) ^ other
335336 }
336337 }
337338
0 commit comments