Skip to content

Commit 71786ee

Browse files
committed
Change rustc_lint
1 parent 49713c0 commit 71786ee

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

compiler/rustc_lint/src/early.rs

+4-19
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ impl<'a, T: EarlyLintPass> EarlyContextAndPass<'a, T> {
6868
}
6969

7070
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+
7175
fn visit_param(&mut self, param: &'a ast::Param) {
7276
self.with_lint_attrs(param.id, &param.attrs, |cx| {
7377
lint_callback!(cx, check_param, param);
@@ -111,17 +115,6 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
111115
self.with_lint_attrs(e.id, &e.attrs, |cx| {
112116
lint_callback!(cx, check_expr, e);
113117
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-
}
125118
lint_callback!(cx, check_expr_post, e);
126119
})
127120
}
@@ -156,14 +149,6 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
156149
lint_callback!(self, check_fn, fk, span, id);
157150
self.check_id(id);
158151
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-
}
167152
}
168153

169154
fn visit_variant_data(&mut self, s: &'a ast::VariantData) {

0 commit comments

Comments
 (0)