Skip to content

Commit e3f1bc8

Browse files
committed
Refactor YieldKind so postfix yield must have an expression
1 parent ed1778c commit e3f1bc8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

clippy_lints/src/suspicious_operation_groupings.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ fn ident_difference_expr_with_base_location(
528528
&strip_non_ident_wrappers(left).kind,
529529
&strip_non_ident_wrappers(right).kind,
530530
) {
531-
(Yield(_, _), Yield(_, _))
531+
(Yield(_), Yield(_))
532532
| (Try(_), Try(_))
533533
| (Paren(_), Paren(_))
534534
| (Repeat(_, _), Repeat(_, _))

clippy_utils/src/ast_utils/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ 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, lk), Yield(r, rk)) => eq_expr_opt(l.as_ref(), r.as_ref()) && lk == rk,
204+
(Yield(l), Yield(r)) => eq_expr_opt(l.expr(), r.expr()) && l.same_kind(r),
205205
(Ret(l), Ret(r)) => eq_expr_opt(l.as_ref(), r.as_ref()),
206206
(Break(ll, le), Break(rl, re)) => eq_label(ll.as_ref(), rl.as_ref()) && eq_expr_opt(le.as_ref(), re.as_ref()),
207207
(Continue(ll), Continue(rl)) => eq_label(ll.as_ref(), rl.as_ref()),

0 commit comments

Comments
 (0)