Refactor LoweringContext::get_delegation_sig_id.
I find the function much easier to read this way. Thanks to @kadiwa4 for the suggestion.
This commit is contained in:
@@ -103,12 +103,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||||||
span: Span,
|
span: Span,
|
||||||
) -> Result<DefId, ErrorGuaranteed> {
|
) -> Result<DefId, ErrorGuaranteed> {
|
||||||
let sig_id = if self.is_in_trait_impl { item_id } else { path_id };
|
let sig_id = if self.is_in_trait_impl { item_id } else { path_id };
|
||||||
let sig_id = self
|
let sig_id =
|
||||||
.resolver
|
self.resolver.get_partial_res(sig_id).and_then(|r| r.expect_full_res().opt_def_id());
|
||||||
.get_partial_res(sig_id)
|
|
||||||
.map(|r| r.expect_full_res().opt_def_id())
|
|
||||||
.unwrap_or(None);
|
|
||||||
|
|
||||||
sig_id.ok_or_else(|| {
|
sig_id.ok_or_else(|| {
|
||||||
self.tcx
|
self.tcx
|
||||||
.dcx()
|
.dcx()
|
||||||
|
|||||||
Reference in New Issue
Block a user