Skip to content

Commit 1f5f8e6

Browse files
workingjubileedavidtwco
authored andcommitted
Curry create_contribution_adjustor at use
1 parent 3a4f847 commit 1f5f8e6

File tree

1 file changed

+10
-40
lines changed

1 file changed

+10
-40
lines changed

thorin/src/package.rs

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -541,46 +541,16 @@ impl<'file> InProgressDwarfPackage<'file> {
541541

542542
// Create offset adjustor functions, see comment on `create_contribution_adjustor` for
543543
// explanation.
544-
let mut abbrev_adjustor = create_contribution_adjustor(
545-
cu_index.as_ref(),
546-
tu_index.as_ref(),
547-
gimli::IndexSectionId::DebugAbbrev,
548-
);
549-
let mut line_adjustor = create_contribution_adjustor(
550-
cu_index.as_ref(),
551-
tu_index.as_ref(),
552-
gimli::IndexSectionId::DebugLine,
553-
);
554-
let mut loc_adjustor = create_contribution_adjustor(
555-
cu_index.as_ref(),
556-
tu_index.as_ref(),
557-
gimli::IndexSectionId::DebugLoc,
558-
);
559-
let mut loclists_adjustor = create_contribution_adjustor(
560-
cu_index.as_ref(),
561-
tu_index.as_ref(),
562-
gimli::IndexSectionId::DebugLocLists,
563-
);
564-
let mut rnglists_adjustor = create_contribution_adjustor(
565-
cu_index.as_ref(),
566-
tu_index.as_ref(),
567-
gimli::IndexSectionId::DebugRngLists,
568-
);
569-
let mut str_offsets_adjustor = create_contribution_adjustor(
570-
cu_index.as_ref(),
571-
tu_index.as_ref(),
572-
gimli::IndexSectionId::DebugStrOffsets,
573-
);
574-
let mut macinfo_adjustor = create_contribution_adjustor(
575-
cu_index.as_ref(),
576-
tu_index.as_ref(),
577-
gimli::IndexSectionId::DebugMacinfo,
578-
);
579-
let mut macro_adjustor = create_contribution_adjustor(
580-
cu_index.as_ref(),
581-
tu_index.as_ref(),
582-
gimli::IndexSectionId::DebugMacro,
583-
);
544+
let adjustor_for_index =
545+
|id| create_contribution_adjustor(cu_index.as_ref(), tu_index.as_ref(), id);
546+
let mut abbrev_adjustor = adjustor_for_index(gimli::IndexSectionId::DebugAbbrev);
547+
let mut line_adjustor = adjustor_for_index(gimli::IndexSectionId::DebugLine);
548+
let mut loc_adjustor = adjustor_for_index(gimli::IndexSectionId::DebugLoc);
549+
let mut loclists_adjustor = adjustor_for_index(gimli::IndexSectionId::DebugLocLists);
550+
let mut rnglists_adjustor = adjustor_for_index(gimli::IndexSectionId::DebugRngLists);
551+
let mut str_offsets_adjustor = adjustor_for_index(gimli::IndexSectionId::DebugStrOffsets);
552+
let mut macinfo_adjustor = adjustor_for_index(gimli::IndexSectionId::DebugMacinfo);
553+
let mut macro_adjustor = adjustor_for_index(gimli::IndexSectionId::DebugMacro);
584554

585555
let mut seen_debug_info = false;
586556
let mut seen_debug_types = false;

0 commit comments

Comments
 (0)