Skip to content

Commit 9576c71

Browse files
committed
Teach rustfmt to handle postfix yield
1 parent 650b7d9 commit 9576c71

File tree

1 file changed

+3
-2
lines changed
  • clippy_utils/src/ast_utils

1 file changed

+3
-2
lines changed

clippy_utils/src/ast_utils/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
201201
(Loop(lt, ll, _), Loop(rt, rl, _)) => eq_label(ll.as_ref(), rl.as_ref()) && eq_block(lt, rt),
202202
(Block(lb, ll), Block(rb, rl)) => eq_label(ll.as_ref(), rl.as_ref()) && eq_block(lb, rb),
203203
(TryBlock(l), TryBlock(r)) => eq_block(l, r),
204-
(Yield(l), Yield(r)) | (Ret(l), Ret(r)) => eq_expr_opt(l.as_ref(), r.as_ref()),
204+
(Yield(l, lk), Yield(r, rk)) => eq_expr_opt(l.as_ref(), r.as_ref()) && lk == rk,
205+
(Ret(l), Ret(r)) => eq_expr_opt(l.as_ref(), r.as_ref()),
205206
(Break(ll, le), Break(rl, re)) => eq_label(ll.as_ref(), rl.as_ref()) && eq_expr_opt(le.as_ref(), re.as_ref()),
206207
(Continue(ll), Continue(rl)) => eq_label(ll.as_ref(), rl.as_ref()),
207208
(Assign(l1, l2, _), Assign(r1, r2, _)) | (Index(l1, l2, _), Index(r1, r2, _)) => {
@@ -688,7 +689,7 @@ pub fn eq_generics(l: &Generics, r: &Generics) -> bool {
688689

689690
pub fn eq_where_predicate(l: &WherePredicate, r: &WherePredicate) -> bool {
690691
use WherePredicateKind::*;
691-
over(&l.attrs, &r.attrs, eq_attr)
692+
over(&l.attrs, &r.attrs, eq_attr)
692693
&& match (&l.kind, &r.kind) {
693694
(BoundPredicate(l), BoundPredicate(r)) => {
694695
over(&l.bound_generic_params, &r.bound_generic_params, |l, r| {

0 commit comments

Comments
 (0)