Skip to content

Commit 8f98b54

Browse files
committed
coverage: Extract helper function term_for_bcb
1 parent 65b323b commit 8f98b54

File tree

1 file changed

+8
-4
lines changed
  • compiler/rustc_mir_transform/src/coverage

1 file changed

+8
-4
lines changed

compiler/rustc_mir_transform/src/coverage/mod.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,18 @@ impl<'a, 'tcx> Instrumentor<'a, 'tcx> {
141141
let file_name =
142142
Symbol::intern(&source_file.name.for_codegen(self.tcx.sess).to_string_lossy());
143143

144+
let term_for_bcb = |bcb| {
145+
coverage_counters
146+
.bcb_counter(bcb)
147+
.expect("all BCBs with spans were given counters")
148+
.as_term()
149+
};
150+
144151
coverage_spans
145152
.bcbs_with_coverage_spans()
146153
// For each BCB with spans, get a coverage term for its counter.
147154
.map(|(bcb, spans)| {
148-
let term = coverage_counters
149-
.bcb_counter(bcb)
150-
.expect("all BCBs with spans were given counters")
151-
.as_term();
155+
let term = term_for_bcb(bcb);
152156
(term, spans)
153157
})
154158
// Flatten the spans into individual term/span pairs.

0 commit comments

Comments
 (0)