about summary refs log tree commit diff
path: root/compiler/rustc_lint
diff options
context:
space:
mode:
authorEric Holk <ericholk@microsoft.com>2023-11-30 16:39:56 -0800
committerEric Holk <ericholk@microsoft.com>2023-12-04 13:03:37 -0800
commitf9d1f922dcd335e534d40923ab54088c07a5403e (patch)
treec268e5049e6492ebdbe081b049c562b51031d799 /compiler/rustc_lint
parent48d5f1f0f26b78f76c5fcf0dda5ac93b8754aeb6 (diff)
downloadrust-f9d1f922dcd335e534d40923ab54088c07a5403e.tar.gz
rust-f9d1f922dcd335e534d40923ab54088c07a5403e.zip
Option<CoroutineKind>
Diffstat (limited to 'compiler/rustc_lint')
-rw-r--r--compiler/rustc_lint/src/early.rs12
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),
             _ => {}