Skip to content

Commit 1c2e9f8

Browse files
Remove unused functions from ast CoroutineKind
1 parent c8f5136 commit 1c2e9f8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

clippy_utils/src/ast_utils.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
221221
) => {
222222
eq_closure_binder(lb, rb)
223223
&& lc == rc
224-
&& la.map_or(false, CoroutineKind::is_async) == ra.map_or(false, CoroutineKind::is_async)
224+
&& eq_coroutine_kind(*la, *ra)
225225
&& lm == rm
226226
&& eq_fn_decl(lf, rf)
227227
&& eq_expr(le, re)
@@ -241,6 +241,16 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
241241
}
242242
}
243243

244+
fn eq_coroutine_kind(a: Option<CoroutineKind>, b: Option<CoroutineKind>) -> bool {
245+
match (a, b) {
246+
(Some(CoroutineKind::Async { .. }), Some(CoroutineKind::Async { .. }))
247+
| (Some(CoroutineKind::Gen { .. }), Some(CoroutineKind::Gen { .. }))
248+
| (Some(CoroutineKind::AsyncGen { .. }), Some(CoroutineKind::AsyncGen { .. }))
249+
| (None, None) => true,
250+
_ => false,
251+
}
252+
}
253+
244254
pub fn eq_field(l: &ExprField, r: &ExprField) -> bool {
245255
l.is_placeholder == r.is_placeholder
246256
&& eq_id(l.ident, r.ident)

0 commit comments

Comments
 (0)