Skip to content

Commit

Permalink
Remove unused functions from ast CoroutineKind
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Sep 11, 2024
1 parent c8f5136 commit 1c2e9f8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion clippy_utils/src/ast_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
) => {
eq_closure_binder(lb, rb)
&& lc == rc
&& la.map_or(false, CoroutineKind::is_async) == ra.map_or(false, CoroutineKind::is_async)
&& eq_coroutine_kind(*la, *ra)
&& lm == rm
&& eq_fn_decl(lf, rf)
&& eq_expr(le, re)
Expand All @@ -241,6 +241,16 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
}
}

fn eq_coroutine_kind(a: Option<CoroutineKind>, b: Option<CoroutineKind>) -> bool {
match (a, b) {
(Some(CoroutineKind::Async { .. }), Some(CoroutineKind::Async { .. }))
| (Some(CoroutineKind::Gen { .. }), Some(CoroutineKind::Gen { .. }))
| (Some(CoroutineKind::AsyncGen { .. }), Some(CoroutineKind::AsyncGen { .. }))
| (None, None) => true,
_ => false,
}
}

pub fn eq_field(l: &ExprField, r: &ExprField) -> bool {
l.is_placeholder == r.is_placeholder
&& eq_id(l.ident, r.ident)
Expand Down

0 comments on commit 1c2e9f8

Please sign in to comment.