@@ -258,26 +258,27 @@ fn expr_is_cmp<'tcx>(
258258 needs_fully_qualified : & mut bool ,
259259) -> bool {
260260 let impl_item_did = impl_item. owner_id . def_id ;
261- if let ExprKind :: Call (
262- Expr {
263- kind : ExprKind :: Path ( some_path ) ,
264- hir_id : some_hir_id ,
265- ..
266- } ,
267- [ cmp_expr ] ,
268- ) = expr . kind
269- {
270- is_res_lang_ctor ( cx, cx. qpath_res ( some_path, * some_hir_id) , LangItem :: OptionSome )
261+ match expr . kind {
262+ ExprKind :: Call (
263+ Expr {
264+ kind : ExprKind :: Path ( some_path ) ,
265+ hir_id : some_hir_id ,
266+ ..
267+ } ,
268+ [ cmp_expr ] ,
269+ ) => {
270+ is_res_lang_ctor ( cx, cx. qpath_res ( some_path, * some_hir_id) , LangItem :: OptionSome )
271271 // Fix #11178, allow `Self::cmp(self, ..)` too
272272 && self_cmp_call ( cx, cmp_expr, impl_item_did, needs_fully_qualified)
273- } else if let ExprKind :: MethodCall ( _, recv, [ ] , _) = expr. kind {
274- cx. tcx
275- . typeck ( impl_item_did)
276- . type_dependent_def_id ( expr. hir_id )
277- . is_some_and ( |def_id| is_diag_trait_item ( cx, def_id, sym:: Into ) )
278- && self_cmp_call ( cx, recv, impl_item_did, needs_fully_qualified)
279- } else {
280- false
273+ } ,
274+ ExprKind :: MethodCall ( _, recv, [ ] , _) => {
275+ cx. tcx
276+ . typeck ( impl_item_did)
277+ . type_dependent_def_id ( expr. hir_id )
278+ . is_some_and ( |def_id| is_diag_trait_item ( cx, def_id, sym:: Into ) )
279+ && self_cmp_call ( cx, recv, impl_item_did, needs_fully_qualified)
280+ } ,
281+ _ => false ,
281282 }
282283}
283284
0 commit comments