File tree 2 files changed +11
-9
lines changed
src/tools/clippy/clippy_utils/src
2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -2610,14 +2610,6 @@ impl CoroutineKind {
2610
2610
}
2611
2611
}
2612
2612
2613
- pub fn is_async ( self ) -> bool {
2614
- matches ! ( self , CoroutineKind :: Async { .. } )
2615
- }
2616
-
2617
- pub fn is_gen ( self ) -> bool {
2618
- matches ! ( self , CoroutineKind :: Gen { .. } )
2619
- }
2620
-
2621
2613
pub fn closure_id ( self ) -> NodeId {
2622
2614
match self {
2623
2615
CoroutineKind :: Async { closure_id, .. }
Original file line number Diff line number Diff line change @@ -221,7 +221,7 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
221
221
) => {
222
222
eq_closure_binder ( lb, rb)
223
223
&& lc == rc
224
- && la . map_or ( false , CoroutineKind :: is_async ) == ra . map_or ( false , CoroutineKind :: is_async )
224
+ && eq_coroutine_kind ( * la , * ra )
225
225
&& lm == rm
226
226
&& eq_fn_decl ( lf, rf)
227
227
&& eq_expr ( le, re)
@@ -241,6 +241,16 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
241
241
}
242
242
}
243
243
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
+
244
254
pub fn eq_field ( l : & ExprField , r : & ExprField ) -> bool {
245
255
l. is_placeholder == r. is_placeholder
246
256
&& eq_id ( l. ident , r. ident )
You can’t perform that action at this time.
0 commit comments