@@ -1026,7 +1026,7 @@ impl<'a> Parser<'a> {
10261026 }
10271027
10281028 /// Is there an `[ impl(in? path) ]? trait` item `dist` tokens ahead?
1029- fn is_impl_restriction_in_front_matter ( & self , dist : usize ) -> bool {
1029+ fn is_trait_with_maybe_impl_restriction_in_front ( & self , dist : usize ) -> bool {
10301030 // `trait`
10311031 if self . is_keyword_ahead ( dist, & [ kw:: Trait ] ) {
10321032 return true ;
@@ -1057,42 +1057,42 @@ impl<'a> Parser<'a> {
10571057 . unwrap_or ( false )
10581058 }
10591059
1060- /// Is this an `(const unsafe? auto? [ impl(in? path) ]?| unsafe auto? [ impl(in? path) ]? | auto [ impl(in? path) ]? | [ impl(in? path) ]) trait` item?
1060+ /// Is this an `(const unsafe? auto? [ impl(in? path) ]? | unsafe auto? [ impl(in? path) ]? | auto [ impl(in? path) ]? | [ impl(in? path) ]? ) trait` item?
10611061 fn check_trait_front_matter ( & mut self ) -> bool {
1062- // [ impl(in? path) ]) trait
1063- if self . is_impl_restriction_in_front_matter ( 0 ) {
1062+ // ` [ impl(in? path) ]? trait`
1063+ if self . is_trait_with_maybe_impl_restriction_in_front ( 0 ) {
10641064 return true ;
10651065 }
1066- // auto [ impl(in? path) ]? trait
1067- if self . check_keyword ( exp ! ( Auto ) ) && self . is_impl_restriction_in_front_matter ( 1 ) {
1066+ // ` auto [ impl(in? path) ]? trait`
1067+ if self . check_keyword ( exp ! ( Auto ) ) && self . is_trait_with_maybe_impl_restriction_in_front ( 1 ) {
10681068 return true ;
10691069 }
1070- // unsafe auto? [ impl(in? path) ]? trait
1070+ // ` unsafe auto? [ impl(in? path) ]? trait`
10711071 if self . check_keyword ( exp ! ( Unsafe ) )
1072- && ( self . is_impl_restriction_in_front_matter ( 1 )
1072+ && ( self . is_trait_with_maybe_impl_restriction_in_front ( 1 )
10731073 || self . is_keyword_ahead ( 1 , & [ kw:: Auto ] )
1074- && self . is_impl_restriction_in_front_matter ( 2 ) )
1074+ && self . is_trait_with_maybe_impl_restriction_in_front ( 2 ) )
10751075 {
10761076 return true ;
10771077 }
1078- // const ...
1078+ // ` const` ...
10791079 if !self . check_keyword ( exp ! ( Const ) ) {
10801080 return false ;
10811081 }
1082- // const [ impl(in? path) ]? trait
1083- if self . is_impl_restriction_in_front_matter ( 1 ) {
1082+ // ` const [ impl(in? path) ]? trait`
1083+ if self . is_trait_with_maybe_impl_restriction_in_front ( 1 ) {
10841084 return true ;
10851085 }
1086- // const (unsafe | auto) [ impl(in? path) ]? trait
1086+ // ` const (unsafe | auto) [ impl(in? path) ]? trait`
10871087 if self . is_keyword_ahead ( 1 , & [ kw:: Unsafe , kw:: Auto ] )
1088- && self . is_impl_restriction_in_front_matter ( 2 )
1088+ && self . is_trait_with_maybe_impl_restriction_in_front ( 2 )
10891089 {
10901090 return true ;
10911091 }
1092- // const unsafe auto [ impl(in? path) ]? trait
1092+ // ` const unsafe auto [ impl(in? path) ]? trait`
10931093 self . is_keyword_ahead ( 1 , & [ kw:: Unsafe ] )
10941094 && self . is_keyword_ahead ( 2 , & [ kw:: Auto ] )
1095- && self . is_impl_restriction_in_front_matter ( 3 )
1095+ && self . is_trait_with_maybe_impl_restriction_in_front ( 3 )
10961096 }
10971097
10981098 /// Parses `const? unsafe? auto? [impl(in? path)]? trait Foo { ... }` or `trait Foo = Bar;`.
0 commit comments