Add ErrorGuaranteed to ast::ExprKind::Err

This commit is contained in:
Lieselotte 2024-02-25 22:22:11 +01:00
parent 66e475794d
commit ef2039effc
2 changed files with 2 additions and 2 deletions

View File

@ -143,7 +143,7 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
match (&l.kind, &r.kind) { match (&l.kind, &r.kind) {
(Paren(l), _) => eq_expr(l, r), (Paren(l), _) => eq_expr(l, r),
(_, Paren(r)) => eq_expr(l, r), (_, Paren(r)) => eq_expr(l, r),
(Err, Err) => true, (Err(_), Err(_)) => true,
(Dummy, _) | (_, Dummy) => unreachable!("comparing `ExprKind::Dummy`"), (Dummy, _) | (_, Dummy) => unreachable!("comparing `ExprKind::Dummy`"),
(Try(l), Try(r)) | (Await(l, _), Await(r, _)) => eq_expr(l, r), (Try(l), Try(r)) | (Await(l, _), Await(r, _)) => eq_expr(l, r),
(Array(l), Array(r)) => over(l, r, |l, r| eq_expr(l, r)), (Array(l), Array(r)) => over(l, r, |l, r| eq_expr(l, r)),

View File

@ -222,7 +222,7 @@ pub fn ast(
| ast::ExprKind::Array(..) | ast::ExprKind::Array(..)
| ast::ExprKind::While(..) | ast::ExprKind::While(..)
| ast::ExprKind::Await(..) | ast::ExprKind::Await(..)
| ast::ExprKind::Err | ast::ExprKind::Err(_)
| ast::ExprKind::Dummy => Sugg::NonParen(snippet_with_context(cx, expr.span, ctxt, default, app).0), | ast::ExprKind::Dummy => Sugg::NonParen(snippet_with_context(cx, expr.span, ctxt, default, app).0),
ast::ExprKind::Range(ref lhs, ref rhs, RangeLimits::HalfOpen) => Sugg::BinOp( ast::ExprKind::Range(ref lhs, ref rhs, RangeLimits::HalfOpen) => Sugg::BinOp(
AssocOp::DotDot, AssocOp::DotDot,