diff options
| author | Eric Holk <ericholk@microsoft.com> | 2025-03-18 12:19:43 -0700 |
|---|---|---|
| committer | Eric Holk <ericholk@microsoft.com> | 2025-03-18 12:19:43 -0700 |
| commit | 2bd7f73c2175c1f0ad56a0be4b5c39e2fc5ab97b (patch) | |
| tree | d040d21539ffd8604385e56f6e2e5a355a9c863f /compiler/rustc_ast_pretty/src/pprust | |
| parent | 299e5d05147c3d3deefd3f85f6e994b5d05fb2f8 (diff) | |
Refactor YieldKind so postfix yield must have an expression
Diffstat (limited to 'compiler/rustc_ast_pretty/src/pprust')
| -rw-r--r-- | compiler/rustc_ast_pretty/src/pprust/state/expr.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs index caba5f2721a..7d9dc89bd75 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs @@ -761,7 +761,7 @@ impl<'a> State<'a> { self.print_expr(e, FixupContext::default()); self.pclose(); } - ast::ExprKind::Yield(e, YieldKind::Prefix) => { + ast::ExprKind::Yield(YieldKind::Prefix(e)) => { self.word("yield"); if let Some(expr) = e { @@ -773,9 +773,7 @@ impl<'a> State<'a> { ); } } - ast::ExprKind::Yield(e, YieldKind::Postfix) => { - // It's not possible to have a postfix yield with no expression. - let e = e.as_ref().unwrap(); + ast::ExprKind::Yield(YieldKind::Postfix(e)) => { self.print_expr_cond_paren( e, e.precedence() < ExprPrecedence::Unambiguous, |
