From 7d82dd0d31b426afaf88d307cc3fb7deddb44552 Mon Sep 17 00:00:00 2001 From: Lieselotte <52315535+she3py@users.noreply.github.com> Date: Sun, 25 Feb 2024 22:22:09 +0100 Subject: [PATCH 1/2] Add `ast::ExprKind::Dummy` --- src/expr.rs | 2 +- src/utils.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/expr.rs b/src/expr.rs index 4b86c2acdc5..d46d7c53bdb 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -404,7 +404,7 @@ fn needs_space_after_range(rhs: &ast::Expr) -> bool { // These do not occur in the AST because macros aren't expanded. unreachable!() } - ast::ExprKind::Err => None, + ast::ExprKind::Err | ast::ExprKind::Dummy => None, }; expr_rw diff --git a/src/utils.rs b/src/utils.rs index 642b6603b1e..b6b37e492e9 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -497,6 +497,7 @@ pub(crate) fn is_block_expr(context: &RewriteContext<'_>, expr: &ast::Expr, repr | ast::ExprKind::Break(..) | ast::ExprKind::Cast(..) | ast::ExprKind::Continue(..) + | ast::ExprKind::Dummy | ast::ExprKind::Err | ast::ExprKind::Field(..) | ast::ExprKind::IncludedBytes(..) From 1bbfb76993eafc9828af62588f13fe68eaeb4e1a Mon Sep 17 00:00:00 2001 From: Lieselotte <52315535+she3py@users.noreply.github.com> Date: Sun, 25 Feb 2024 22:22:11 +0100 Subject: [PATCH 2/2] Add `ErrorGuaranteed` to `ast::ExprKind::Err` --- src/expr.rs | 2 +- src/utils.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/expr.rs b/src/expr.rs index d46d7c53bdb..c500b30b998 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -404,7 +404,7 @@ fn needs_space_after_range(rhs: &ast::Expr) -> bool { // These do not occur in the AST because macros aren't expanded. unreachable!() } - ast::ExprKind::Err | ast::ExprKind::Dummy => None, + ast::ExprKind::Err(_) | ast::ExprKind::Dummy => None, }; expr_rw diff --git a/src/utils.rs b/src/utils.rs index b6b37e492e9..d4218cff75a 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -498,7 +498,7 @@ pub(crate) fn is_block_expr(context: &RewriteContext<'_>, expr: &ast::Expr, repr | ast::ExprKind::Cast(..) | ast::ExprKind::Continue(..) | ast::ExprKind::Dummy - | ast::ExprKind::Err + | ast::ExprKind::Err(_) | ast::ExprKind::Field(..) | ast::ExprKind::IncludedBytes(..) | ast::ExprKind::InlineAsm(..)