Flatten match

This commit is contained in:
Michael Goulet 2023-12-25 18:05:32 +00:00
parent 27dce304cb
commit ba912855cc

View File

@ -686,11 +686,18 @@ fn give_name_if_anonymous_region_appears_in_output(&self, fr: RegionVid) -> Opti
let mir_description = match kind { let mir_description = match kind {
hir::ClosureKind::Coroutine(hir::CoroutineKind::Desugared( hir::ClosureKind::Coroutine(hir::CoroutineKind::Desugared(
hir::CoroutineDesugaring::Async, hir::CoroutineDesugaring::Async,
src, hir::CoroutineSource::Block,
)) => match src { )) => " of async block",
hir::CoroutineSource::Block => " of async block",
hir::CoroutineSource::Closure => " of async closure", hir::ClosureKind::Coroutine(hir::CoroutineKind::Desugared(
hir::CoroutineSource::Fn => { hir::CoroutineDesugaring::Async,
hir::CoroutineSource::Closure,
)) => " of async closure",
hir::ClosureKind::Coroutine(hir::CoroutineKind::Desugared(
hir::CoroutineDesugaring::Async,
hir::CoroutineSource::Fn,
)) => {
let parent_item = let parent_item =
tcx.hir_node_by_def_id(hir.get_parent_item(mir_hir_id).def_id); tcx.hir_node_by_def_id(hir.get_parent_item(mir_hir_id).def_id);
let output = &parent_item let output = &parent_item
@ -703,14 +710,21 @@ fn give_name_if_anonymous_region_appears_in_output(&self, fr: RegionVid) -> Opti
} }
" of async function" " of async function"
} }
},
hir::ClosureKind::Coroutine(hir::CoroutineKind::Desugared( hir::ClosureKind::Coroutine(hir::CoroutineKind::Desugared(
hir::CoroutineDesugaring::Gen, hir::CoroutineDesugaring::Gen,
src, hir::CoroutineSource::Block,
)) => match src { )) => " of gen block",
hir::CoroutineSource::Block => " of gen block",
hir::CoroutineSource::Closure => " of gen closure", hir::ClosureKind::Coroutine(hir::CoroutineKind::Desugared(
hir::CoroutineSource::Fn => { hir::CoroutineDesugaring::Gen,
hir::CoroutineSource::Closure,
)) => " of gen closure",
hir::ClosureKind::Coroutine(hir::CoroutineKind::Desugared(
hir::CoroutineDesugaring::Gen,
hir::CoroutineSource::Fn,
)) => {
let parent_item = let parent_item =
tcx.hir_node_by_def_id(hir.get_parent_item(mir_hir_id).def_id); tcx.hir_node_by_def_id(hir.get_parent_item(mir_hir_id).def_id);
let output = &parent_item let output = &parent_item
@ -720,15 +734,21 @@ fn give_name_if_anonymous_region_appears_in_output(&self, fr: RegionVid) -> Opti
span = output.span(); span = output.span();
" of gen function" " of gen function"
} }
},
hir::ClosureKind::Coroutine(hir::CoroutineKind::Desugared( hir::ClosureKind::Coroutine(hir::CoroutineKind::Desugared(
hir::CoroutineDesugaring::AsyncGen, hir::CoroutineDesugaring::AsyncGen,
src, hir::CoroutineSource::Block,
)) => match src { )) => " of async gen block",
hir::CoroutineSource::Block => " of async gen block",
hir::CoroutineSource::Closure => " of async gen closure", hir::ClosureKind::Coroutine(hir::CoroutineKind::Desugared(
hir::CoroutineSource::Fn => { hir::CoroutineDesugaring::AsyncGen,
hir::CoroutineSource::Closure,
)) => " of async gen closure",
hir::ClosureKind::Coroutine(hir::CoroutineKind::Desugared(
hir::CoroutineDesugaring::AsyncGen,
hir::CoroutineSource::Fn,
)) => {
let parent_item = let parent_item =
tcx.hir_node_by_def_id(hir.get_parent_item(mir_hir_id).def_id); tcx.hir_node_by_def_id(hir.get_parent_item(mir_hir_id).def_id);
let output = &parent_item let output = &parent_item
@ -738,7 +758,7 @@ fn give_name_if_anonymous_region_appears_in_output(&self, fr: RegionVid) -> Opti
span = output.span(); span = output.span();
" of async gen function" " of async gen function"
} }
},
hir::ClosureKind::Coroutine(hir::CoroutineKind::Coroutine(_)) => { hir::ClosureKind::Coroutine(hir::CoroutineKind::Coroutine(_)) => {
" of coroutine" " of coroutine"
} }