@@ -18,6 +18,7 @@ use crate::lists::{
1818 definitive_tactic, itemize_list, write_list, ListFormatting , ListItem , Separator ,
1919} ;
2020use crate :: macros:: MacroArg ;
21+ use crate :: parse:: macros:: matches:: MatchesMacroItem ;
2122use crate :: patterns:: { can_be_overflowed_pat, TuplePatField } ;
2223use crate :: rewrite:: { Rewrite , RewriteContext } ;
2324use crate :: shape:: Shape ;
@@ -76,6 +77,7 @@ pub(crate) enum OverflowableItem<'a> {
7677 TuplePatField ( & ' a TuplePatField < ' a > ) ,
7778 Ty ( & ' a ast:: Ty ) ,
7879 Pat ( & ' a ast:: Pat ) ,
80+ MatchesMacroItem ( & ' a MatchesMacroItem ) ,
7981}
8082
8183impl < ' a > Rewrite for OverflowableItem < ' a > {
@@ -116,6 +118,7 @@ impl<'a> OverflowableItem<'a> {
116118 OverflowableItem :: TuplePatField ( pat) => f ( * pat) ,
117119 OverflowableItem :: Ty ( ty) => f ( * ty) ,
118120 OverflowableItem :: Pat ( pat) => f ( * pat) ,
121+ OverflowableItem :: MatchesMacroItem ( item) => f ( * item) ,
119122 }
120123 }
121124
@@ -137,7 +140,9 @@ impl<'a> OverflowableItem<'a> {
137140 pub ( crate ) fn is_expr ( & self ) -> bool {
138141 matches ! (
139142 self ,
140- OverflowableItem :: Expr ( ..) | OverflowableItem :: MacroArg ( MacroArg :: Expr ( ..) )
143+ OverflowableItem :: Expr ( ..)
144+ | OverflowableItem :: MacroArg ( MacroArg :: Expr ( ..) )
145+ | OverflowableItem :: MatchesMacroItem ( MatchesMacroItem :: Expr ( ..) )
141146 )
142147 }
143148
@@ -153,6 +158,7 @@ impl<'a> OverflowableItem<'a> {
153158 match self {
154159 OverflowableItem :: Expr ( expr) => Some ( expr) ,
155160 OverflowableItem :: MacroArg ( MacroArg :: Expr ( ref expr) ) => Some ( expr) ,
161+ OverflowableItem :: MatchesMacroItem ( MatchesMacroItem :: Expr ( expr) ) => Some ( expr) ,
156162 _ => None ,
157163 }
158164 }
@@ -233,7 +239,10 @@ macro_rules! impl_into_overflowable_item_for_rustfmt_types {
233239}
234240
235241impl_into_overflowable_item_for_ast_node ! ( Expr , GenericParam , NestedMetaItem , FieldDef , Ty , Pat ) ;
236- impl_into_overflowable_item_for_rustfmt_types ! ( [ MacroArg ] , [ SegmentParam , TuplePatField ] ) ;
242+ impl_into_overflowable_item_for_rustfmt_types ! (
243+ [ MacroArg , MatchesMacroItem ] ,
244+ [ SegmentParam , TuplePatField ]
245+ ) ;
237246
238247pub ( crate ) fn into_overflowable_list < ' a , T > (
239248 iter : impl Iterator < Item = & ' a T > ,
0 commit comments