@@ -68,6 +68,10 @@ impl<'a, T: EarlyLintPass> EarlyContextAndPass<'a, T> {
68
68
}
69
69
70
70
impl < ' a , T : EarlyLintPass > ast_visit:: Visitor < ' a > for EarlyContextAndPass < ' a , T > {
71
+ fn visit_coroutine_kind ( & mut self , coroutine_kind : & ' a ast:: CoroutineKind ) -> Self :: Result {
72
+ self . check_id ( coroutine_kind. closure_id ( ) ) ;
73
+ }
74
+
71
75
fn visit_param ( & mut self , param : & ' a ast:: Param ) {
72
76
self . with_lint_attrs ( param. id , & param. attrs , |cx| {
73
77
lint_callback ! ( cx, check_param, param) ;
@@ -111,17 +115,6 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
111
115
self . with_lint_attrs ( e. id , & e. attrs , |cx| {
112
116
lint_callback ! ( cx, check_expr, e) ;
113
117
ast_visit:: walk_expr ( cx, e) ;
114
- // Explicitly check for lints associated with 'closure_id', since
115
- // it does not have a corresponding AST node
116
- match e. kind {
117
- ast:: ExprKind :: Closure ( box ast:: Closure {
118
- coroutine_kind : Some ( coroutine_kind) ,
119
- ..
120
- } ) => {
121
- cx. check_id ( coroutine_kind. closure_id ( ) ) ;
122
- }
123
- _ => { }
124
- }
125
118
lint_callback ! ( cx, check_expr_post, e) ;
126
119
} )
127
120
}
@@ -156,14 +149,6 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
156
149
lint_callback ! ( self , check_fn, fk, span, id) ;
157
150
self . check_id ( id) ;
158
151
ast_visit:: walk_fn ( self , fk) ;
159
-
160
- // Explicitly check for lints associated with 'closure_id', since
161
- // it does not have a corresponding AST node
162
- if let ast_visit:: FnKind :: Fn ( _, _, sig, _, _, _) = fk {
163
- if let Some ( coroutine_kind) = sig. header . coroutine_kind {
164
- self . check_id ( coroutine_kind. closure_id ( ) ) ;
165
- }
166
- }
167
152
}
168
153
169
154
fn visit_variant_data ( & mut self , s : & ' a ast:: VariantData ) {
0 commit comments