@@ -195,6 +195,7 @@ enum ChainItemKind {
195
195
StructField ( symbol:: Ident ) ,
196
196
TupleField ( symbol:: Ident , bool ) ,
197
197
Await ,
198
+ Yield ,
198
199
Comment ( String , CommentPosition ) ,
199
200
}
200
201
@@ -206,6 +207,7 @@ impl ChainItemKind {
206
207
| ChainItemKind :: StructField ( ..)
207
208
| ChainItemKind :: TupleField ( ..)
208
209
| ChainItemKind :: Await
210
+ | ChainItemKind :: Yield
209
211
| ChainItemKind :: Comment ( ..) => false ,
210
212
}
211
213
}
@@ -260,6 +262,10 @@ impl ChainItemKind {
260
262
let span = mk_sp ( nested. span . hi ( ) , expr. span . hi ( ) ) ;
261
263
( ChainItemKind :: Await , span)
262
264
}
265
+ ast:: ExprKind :: Yield ( ast:: YieldKind :: Postfix ( ref nested) ) => {
266
+ let span = mk_sp ( nested. span . hi ( ) , expr. span . hi ( ) ) ;
267
+ ( ChainItemKind :: Yield , span)
268
+ }
263
269
_ => {
264
270
return (
265
271
ChainItemKind :: Parent {
@@ -307,6 +313,7 @@ impl Rewrite for ChainItem {
307
313
rewrite_ident( context, ident)
308
314
) ,
309
315
ChainItemKind :: Await => ".await" . to_owned ( ) ,
316
+ ChainItemKind :: Yield => ".yield" . to_owned ( ) ,
310
317
ChainItemKind :: Comment ( ref comment, _) => {
311
318
rewrite_comment ( comment, false , shape, context. config ) ?
312
319
}
@@ -509,7 +516,8 @@ impl Chain {
509
516
} ) ,
510
517
ast:: ExprKind :: Field ( ref subexpr, _)
511
518
| ast:: ExprKind :: Try ( ref subexpr)
512
- | ast:: ExprKind :: Await ( ref subexpr, _) => Some ( SubExpr {
519
+ | ast:: ExprKind :: Await ( ref subexpr, _)
520
+ | ast:: ExprKind :: Yield ( ast:: YieldKind :: Postfix ( ref subexpr) ) => Some ( SubExpr {
513
521
expr : Self :: convert_try ( subexpr, context) ,
514
522
is_method_call_receiver : false ,
515
523
} ) ,
0 commit comments