Skip to content

Commit 29e0881

Browse files
Lambdariszhuyunxing
authored and
zhuyunxing
committed
coverage. Adopt a nicer dereference style for BcbMappingKind
1 parent c8bf124 commit 29e0881

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

compiler/rustc_mir_transform/src/coverage/mod.rs

+8-11
Original file line numberDiff line numberDiff line change
@@ -142,27 +142,24 @@ fn create_mappings<'tcx>(
142142

143143
mappings.extend(coverage_spans.all_bcb_mappings().filter_map(
144144
|BcbMapping { kind: bcb_mapping_kind, span }| {
145-
let kind = match bcb_mapping_kind {
146-
BcbMappingKind::Code(bcb) => MappingKind::Code(term_for_bcb(*bcb)),
145+
let kind = match *bcb_mapping_kind {
146+
BcbMappingKind::Code(bcb) => MappingKind::Code(term_for_bcb(bcb)),
147147
BcbMappingKind::Branch { true_bcb, false_bcb, condition_info } => {
148148
if condition_info.condition_id == ConditionId::NONE {
149149
MappingKind::Branch {
150-
true_term: term_for_bcb(*true_bcb),
151-
false_term: term_for_bcb(*false_bcb),
150+
true_term: term_for_bcb(true_bcb),
151+
false_term: term_for_bcb(false_bcb),
152152
}
153153
} else {
154154
MappingKind::MCDCBranch {
155-
true_term: term_for_bcb(*true_bcb),
156-
false_term: term_for_bcb(*false_bcb),
157-
mcdc_params: *condition_info,
155+
true_term: term_for_bcb(true_bcb),
156+
false_term: term_for_bcb(false_bcb),
157+
mcdc_params: condition_info,
158158
}
159159
}
160160
}
161161
BcbMappingKind::Decision { bitmap_idx, conditions_num, .. } => {
162-
MappingKind::MCDCDecision(DecisionInfo {
163-
bitmap_idx: *bitmap_idx,
164-
conditions_num: *conditions_num,
165-
})
162+
MappingKind::MCDCDecision(DecisionInfo { bitmap_idx, conditions_num })
166163
}
167164
};
168165
let code_region = make_code_region(source_map, file_name, *span, body_span)?;

compiler/rustc_mir_transform/src/coverage/spans.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,18 @@ pub(super) fn generate_coverage_spans(
101101
};
102102
let mut test_vector_bitmap_bytes = 0;
103103
for BcbMapping { kind, span: _ } in &mappings {
104-
match kind {
105-
BcbMappingKind::Code(bcb) => insert(*bcb),
104+
match *kind {
105+
BcbMappingKind::Code(bcb) => insert(bcb),
106106
BcbMappingKind::Branch { true_bcb, false_bcb, .. } => {
107-
insert(*true_bcb);
108-
insert(*false_bcb);
107+
insert(true_bcb);
108+
insert(false_bcb);
109109
}
110110
BcbMappingKind::Decision { bitmap_idx, conditions_num, .. } => {
111111
// `bcb_has_mappings` is used for inject coverage counters
112112
// but they are not needed for decision BCBs.
113113
// While the length of test vector bitmap should be calculated here.
114114
test_vector_bitmap_bytes = test_vector_bitmap_bytes
115-
.max(bitmap_idx + (1_u32 << *conditions_num as u32).div_ceil(8));
115+
.max(bitmap_idx + (1_u32 << conditions_num as u32).div_ceil(8));
116116
}
117117
}
118118
}

0 commit comments

Comments
 (0)