Simplify checking for GeneratorKind::Async

Adds a helper method around `generator_kind` that makes matching async constructs simpler.
This commit is contained in:
Arpad Borsos
2022-11-26 21:33:12 +01:00
parent 8a09420ac4
commit 2db0dc3297
5 changed files with 10 additions and 22 deletions

View File

@@ -430,9 +430,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
) {
let self_ty = obligation.self_ty().skip_binder();
if let ty::Generator(did, ..) = self_ty.kind() {
if let Some(rustc_hir::GeneratorKind::Async(_generator_kind)) =
self.tcx().generator_kind(did)
{
if self.tcx().generator_is_async(*did) {
debug!(?self_ty, ?obligation, "assemble_future_candidates",);
candidates.vec.push(FutureCandidate);