about summary refs log tree commit diff
path: root/src/expr.rs
diff options
context:
space:
mode:
authorCaleb Cartwright <calebcartwright@users.noreply.github.com>2023-12-13 14:18:07 -0600
committerGitHub <noreply@github.com>2023-12-13 14:18:07 -0600
commit20196767d4f04c83e9edefd09200210bbd2b1994 (patch)
tree9fec9533aedf83bdeec49f6dce7883408fcdd1aa /src/expr.rs
parent2174e6052dcb1802417d686140fe0ab7cbef0df2 (diff)
parent03510f35150c33cc87dc557c6a3be586c1a6d10a (diff)
Merge pull request #5980 from ytmimi/subtree_push_2023_12_12
Subtree push 2023-12-12
Diffstat (limited to 'src/expr.rs')
-rw-r--r--src/expr.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/expr.rs b/src/expr.rs
index acde8809329..a68bd6694ba 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -212,7 +212,7 @@ pub(crate) fn format_expr(
             &cl.binder,
             cl.constness,
             cl.capture_clause,
-            &cl.asyncness,
+            &cl.coroutine_kind,
             cl.movability,
             &cl.fn_decl,
             &cl.body,
@@ -367,15 +367,15 @@ pub(crate) fn format_expr(
                 ))
             }
         }
-        ast::ExprKind::Async(capture_by, ref block) => {
-            let mover = if capture_by == ast::CaptureBy::Value {
+        ast::ExprKind::Gen(capture_by, ref block, ref kind) => {
+            let mover = if matches!(capture_by, ast::CaptureBy::Value { .. }) {
                 "move "
             } else {
                 ""
             };
             if let rw @ Some(_) = rewrite_single_line_block(
                 context,
-                format!("async {mover}").as_str(),
+                format!("{kind} {mover}").as_str(),
                 block,
                 Some(&expr.attrs),
                 None,
@@ -386,7 +386,7 @@ pub(crate) fn format_expr(
                 // 6 = `async `
                 let budget = shape.width.saturating_sub(6);
                 Some(format!(
-                    "async {mover}{}",
+                    "{kind} {mover}{}",
                     rewrite_block(
                         block,
                         Some(&expr.attrs),
@@ -1371,7 +1371,7 @@ pub(crate) fn can_be_overflowed_expr(
         }
 
         // Handle always block-like expressions
-        ast::ExprKind::Async(..) | ast::ExprKind::Block(..) | ast::ExprKind::Closure(..) => true,
+        ast::ExprKind::Gen(..) | ast::ExprKind::Block(..) | ast::ExprKind::Closure(..) => true,
 
         // Handle `[]` and `{}`-like expressions
         ast::ExprKind::Array(..) | ast::ExprKind::Struct(..) => {
@@ -1933,7 +1933,7 @@ fn rewrite_unary_op(
     shape: Shape,
 ) -> Option<String> {
     // For some reason, an UnOp is not spanned like BinOp!
-    rewrite_unary_prefix(context, ast::UnOp::to_string(op), expr, shape)
+    rewrite_unary_prefix(context, op.as_str(), expr, shape)
 }
 
 pub(crate) enum RhsAssignKind<'ast> {