@@ -25,13 +25,8 @@ enum FlagValue<'a> {
2525}
2626
2727impl FlagValue < ' _ > {
28- // matches! is beyond our MSRV
29- #[ allow( clippy:: match_like_matches_macro) ]
3028 fn is_inferred ( & self ) -> bool {
31- match self {
32- FlagValue :: Inferred ( _) => true ,
33- _ => false ,
34- }
29+ matches ! ( self , FlagValue :: Inferred ( _) )
3530 }
3631}
3732
@@ -110,15 +105,11 @@ fn collect_flags<'a>(
110105) -> Result < Vec < Flag < ' a > > , syn:: Error > {
111106 variants
112107 . map ( |variant| {
113- // MSRV: Would this be cleaner with `matches!`?
114- match variant. fields {
115- syn:: Fields :: Unit => ( ) ,
116- _ => {
117- return Err ( syn:: Error :: new_spanned (
118- & variant. fields ,
119- "Bitflag variants cannot contain additional data" ,
120- ) )
121- }
108+ if !matches ! ( variant. fields, syn:: Fields :: Unit ) {
109+ return Err ( syn:: Error :: new_spanned (
110+ & variant. fields ,
111+ "Bitflag variants cannot contain additional data" ,
112+ ) ) ;
122113 }
123114
124115 let name = variant. ident . clone ( ) ;
@@ -244,15 +235,8 @@ fn check_flag(type_name: &Ident, flag: &Flag, bits: u8) -> Result<Option<TokenSt
244235 Inferred ( _) => Ok ( None ) ,
245236 Deferred => {
246237 let variant_name = & flag. name ;
247- // MSRV: Use an unnamed constant (`const _: ...`).
248- let assertion_name = syn:: Ident :: new (
249- & format ! ( "__enumflags_assertion_{}_{}" , type_name, flag. name) ,
250- Span :: call_site ( ) ,
251- ) ; // call_site because def_site is unstable
252-
253238 Ok ( Some ( quote_spanned ! ( flag. span =>
254- #[ doc( hidden) ]
255- const #assertion_name:
239+ const _:
256240 <<[ ( ) ; (
257241 ( #type_name:: #variant_name as u128 ) . is_power_of_two( )
258242 ) as usize ] as enumflags2:: _internal:: AssertionHelper >
0 commit comments