File tree Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Original file line number Diff line number Diff line change @@ -263,12 +263,10 @@ fn rewrite_closure_fn_decl(
263263 } else {
264264 ""
265265 } ;
266- let ( is_async, is_gen) = if let Some ( coro_kind) = coro_kind {
267- let is_async = if coro_kind. is_async ( ) { "async " } else { "" } ;
268- let is_gen = if coro_kind. is_gen ( ) { "gen " } else { "" } ;
269- ( is_async, is_gen)
270- } else {
271- ( "" , "" )
266+ let coro = match coro_kind {
267+ Some ( ast:: CoroutineKind :: Async { .. } ) => "async " ,
268+ Some ( ast:: CoroutineKind :: Gen { .. } ) => "gen " ,
269+ None => "" ,
272270 } ;
273271 let mover = if matches ! ( capture, ast:: CaptureBy :: Value { .. } ) {
274272 "move "
@@ -278,14 +276,7 @@ fn rewrite_closure_fn_decl(
278276 // 4 = "|| {".len(), which is overconservative when the closure consists of
279277 // a single expression.
280278 let nested_shape = shape
281- . shrink_left (
282- binder. len ( )
283- + const_. len ( )
284- + immovable. len ( )
285- + is_async. len ( )
286- + is_gen. len ( )
287- + mover. len ( ) ,
288- ) ?
279+ . shrink_left ( binder. len ( ) + const_. len ( ) + immovable. len ( ) + coro. len ( ) + mover. len ( ) ) ?
289280 . sub_width ( 4 ) ?;
290281
291282 // 1 = |
@@ -323,7 +314,7 @@ fn rewrite_closure_fn_decl(
323314 . tactic ( tactic)
324315 . preserve_newline ( true ) ;
325316 let list_str = write_list ( & item_vec, & fmt) ?;
326- let mut prefix = format ! ( "{binder}{const_}{immovable}{is_async}{is_gen }{mover}|{list_str}|" ) ;
317+ let mut prefix = format ! ( "{binder}{const_}{immovable}{coro }{mover}|{list_str}|" ) ;
327318
328319 if !ret_str. is_empty ( ) {
329320 if prefix. contains ( '\n' ) {
You can’t perform that action at this time.
0 commit comments