@@ -192,6 +192,7 @@ enum ChainItemKind {
192192 StructField ( symbol:: Ident ) ,
193193 TupleField ( symbol:: Ident , bool ) ,
194194 Await ,
195+ Yield ,
195196 Comment ( String , CommentPosition ) ,
196197}
197198
@@ -203,6 +204,7 @@ impl ChainItemKind {
203204 | ChainItemKind :: StructField ( ..)
204205 | ChainItemKind :: TupleField ( ..)
205206 | ChainItemKind :: Await
207+ | ChainItemKind :: Yield
206208 | ChainItemKind :: Comment ( ..) => false ,
207209 }
208210 }
@@ -257,6 +259,10 @@ impl ChainItemKind {
257259 let span = mk_sp ( nested. span . hi ( ) , expr. span . hi ( ) ) ;
258260 ( ChainItemKind :: Await , span)
259261 }
262+ ast:: ExprKind :: Yield ( Some ( ref nested) , ast:: YieldKind :: Postfix ) => {
263+ let span = mk_sp ( nested. span . hi ( ) , expr. span . hi ( ) ) ;
264+ ( ChainItemKind :: Yield , span)
265+ }
260266 _ => {
261267 return (
262268 ChainItemKind :: Parent {
@@ -306,6 +312,7 @@ impl Rewrite for ChainItem {
306312 rewrite_ident( context, ident)
307313 ) ,
308314 ChainItemKind :: Await => ".await" . to_owned ( ) ,
315+ ChainItemKind :: Yield => ".yield" . to_owned ( ) ,
309316 ChainItemKind :: Comment ( ref comment, _) => {
310317 rewrite_comment ( comment, false , shape, context. config ) ?
311318 }
@@ -508,7 +515,8 @@ impl Chain {
508515 } ) ,
509516 ast:: ExprKind :: Field ( ref subexpr, _)
510517 | ast:: ExprKind :: Try ( ref subexpr)
511- | ast:: ExprKind :: Await ( ref subexpr, _) => Some ( SubExpr {
518+ | ast:: ExprKind :: Await ( ref subexpr, _)
519+ | ast:: ExprKind :: Yield ( Some ( ref subexpr) , ast:: YieldKind :: Postfix ) => Some ( SubExpr {
512520 expr : Self :: convert_try ( subexpr, context) ,
513521 is_method_call_receiver : false ,
514522 } ) ,
0 commit comments