@@ -18,7 +18,7 @@ use rustc_lint::{LateContext, LateLintPass, Lint, LintContext};
18
18
use rustc_middle:: hir:: map:: Map ;
19
19
use rustc_middle:: lint:: in_external_macro;
20
20
use rustc_middle:: ty:: subst:: GenericArgKind ;
21
- use rustc_middle:: ty:: { self , Predicate , Ty } ;
21
+ use rustc_middle:: ty:: { self , Ty } ;
22
22
use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
23
23
use rustc_span:: source_map:: Span ;
24
24
use rustc_span:: symbol:: { sym, SymbolStr } ;
@@ -1496,17 +1496,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Methods {
1496
1496
if let ty:: Opaque ( def_id, _) = ret_ty. kind {
1497
1497
// one of the associated types must be Self
1498
1498
for predicate in cx. tcx . predicates_of ( def_id) . predicates {
1499
- match predicate {
1500
- ( Predicate :: Projection ( poly_projection_predicate) , _) => {
1501
- let binder = poly_projection_predicate. ty ( ) ;
1502
- let associated_type = binder. skip_binder ( ) ;
1503
-
1504
- // walk the associated type and check for Self
1505
- if contains_self_ty ( associated_type) {
1506
- return ;
1507
- }
1508
- } ,
1509
- ( _, _) => { } ,
1499
+ if let ty:: PredicateKind :: Projection ( poly_projection_predicate) = predicate. 0 . kind ( ) {
1500
+ let binder = poly_projection_predicate. ty ( ) ;
1501
+ let associated_type = binder. skip_binder ( ) ;
1502
+
1503
+ // walk the associated type and check for Self
1504
+ if contains_self_ty ( associated_type) {
1505
+ return ;
1506
+ }
1510
1507
}
1511
1508
}
1512
1509
}
0 commit comments