From 85e688e4c3c14df05b6430ae7d736ffc9180e9c7 Mon Sep 17 00:00:00 2001 From: Wei Liu <liuw@liuw.name> Date: Fri, 6 May 2022 14:59:40 +0000 Subject: [PATCH 1/2] Fix comment for async closure variant --- compiler/rustc_hir/src/hir.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index dfeee3f356ffb..9f3072e169c6c 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -1441,7 +1441,7 @@ pub enum AsyncGeneratorKind { /// An explicit `async` block written by the user. Block, - /// An explicit `async` block written by the user. + /// An explicit `async` closure written by the user. Closure, /// The `async` block generated as the body of an async function. From fcb385cfb116d4689ddc4ffc121d650bdc94ad91 Mon Sep 17 00:00:00 2001 From: Wei Liu <liuw@liuw.name> Date: Fri, 6 May 2022 15:00:48 +0000 Subject: [PATCH 2/2] Use matches! for YieldSource::is_await --- compiler/rustc_hir/src/hir.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 9f3072e169c6c..cc6ddad2e15df 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -2078,10 +2078,7 @@ pub enum YieldSource { impl YieldSource { pub fn is_await(&self) -> bool { - match self { - YieldSource::Await { .. } => true, - YieldSource::Yield => false, - } + matches!(self, YieldSource::Await { .. }) } }