Skip to content

Commit c743e4a

Browse files
committed
Refactor LoweringContext::get_delegation_sig_id.
I find the function much easier to read this way. Thanks to @kadiwa4 for the suggestion.
1 parent 2fc94ce commit c743e4a

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

compiler/rustc_ast_lowering/src/delegation.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
103103
span: Span,
104104
) -> Result<DefId, ErrorGuaranteed> {
105105
let sig_id = if self.is_in_trait_impl { item_id } else { path_id };
106-
let sig_id = self
107-
.resolver
108-
.get_partial_res(sig_id)
109-
.map(|r| r.expect_full_res().opt_def_id())
110-
.unwrap_or(None);
111-
106+
let sig_id =
107+
self.resolver.get_partial_res(sig_id).and_then(|r| r.expect_full_res().opt_def_id());
112108
sig_id.ok_or_else(|| {
113109
self.tcx
114110
.dcx()

0 commit comments

Comments
 (0)