diff options
| author | Eric Holk <ericholk@microsoft.com> | 2023-11-30 16:39:56 -0800 |
|---|---|---|
| committer | Eric Holk <ericholk@microsoft.com> | 2023-12-04 13:03:37 -0800 |
| commit | f9d1f922dcd335e534d40923ab54088c07a5403e (patch) | |
| tree | c268e5049e6492ebdbe081b049c562b51031d799 /compiler/rustc_lint | |
| parent | 48d5f1f0f26b78f76c5fcf0dda5ac93b8754aeb6 (diff) | |
| download | rust-f9d1f922dcd335e534d40923ab54088c07a5403e.tar.gz rust-f9d1f922dcd335e534d40923ab54088c07a5403e.zip | |
Option<CoroutineKind>
Diffstat (limited to 'compiler/rustc_lint')
| -rw-r--r-- | compiler/rustc_lint/src/early.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/rustc_lint/src/early.rs b/compiler/rustc_lint/src/early.rs index 41fbf1f3e2c..7c4f81a4c39 100644 --- a/compiler/rustc_lint/src/early.rs +++ b/compiler/rustc_lint/src/early.rs @@ -162,8 +162,10 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T> // Explicitly check for lints associated with 'closure_id', since // it does not have a corresponding AST node if let ast_visit::FnKind::Fn(_, _, sig, _, _, _) = fk { - if let ast::CoroutineKind::Async { closure_id, .. } - | ast::CoroutineKind::Gen { closure_id, .. } = sig.header.coro_kind + if let Some( + ast::CoroutineKind::Async { closure_id, .. } + | ast::CoroutineKind::Gen { closure_id, .. }, + ) = sig.header.coro_kind { self.check_id(closure_id); } @@ -226,8 +228,10 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T> match e.kind { ast::ExprKind::Closure(box ast::Closure { coro_kind: - ast::CoroutineKind::Async { closure_id, .. } - | ast::CoroutineKind::Gen { closure_id, .. }, + Some( + ast::CoroutineKind::Async { closure_id, .. } + | ast::CoroutineKind::Gen { closure_id, .. }, + ), .. }) => self.check_id(closure_id), _ => {} |
