diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2023-10-29 20:53:17 +1100 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2023-10-30 12:46:43 +1100 |
| commit | 2f1be08473e07e15d848b21e159be6729ffd90d2 (patch) | |
| tree | 379c0073bfcae361ecbbfdc685ad0e1954c26ebd /compiler/rustc_mir_transform/src/coverage | |
| parent | 6d69eb1f2e3d130a3e01412958f2387c1ad3b047 (diff) | |
| download | rust-2f1be08473e07e15d848b21e159be6729ffd90d2.tar.gz rust-2f1be08473e07e15d848b21e159be6729ffd90d2.zip | |
coverage: Inline the "recursive" worker methods for assigning counters
Now that we don't manually pass around indent levels, there's no need for these worker methods to exist separately from their main callers.
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage')
| -rw-r--r-- | compiler/rustc_mir_transform/src/coverage/counters.rs | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/compiler/rustc_mir_transform/src/coverage/counters.rs b/compiler/rustc_mir_transform/src/coverage/counters.rs index 2e3e560975f..8909de14333 100644 --- a/compiler/rustc_mir_transform/src/coverage/counters.rs +++ b/compiler/rustc_mir_transform/src/coverage/counters.rs @@ -344,15 +344,8 @@ impl<'a> MakeBcbCounters<'a> { Ok(()) } - fn get_or_make_counter_operand(&mut self, bcb: BasicCoverageBlock) -> Result<CovTerm, Error> { - self.recursive_get_or_make_counter_operand(bcb) - } - #[instrument(level = "debug", skip(self))] - fn recursive_get_or_make_counter_operand( - &mut self, - bcb: BasicCoverageBlock, - ) -> Result<CovTerm, Error> { + fn get_or_make_counter_operand(&mut self, bcb: BasicCoverageBlock) -> Result<CovTerm, Error> { // If the BCB already has a counter, return it. if let Some(counter_kind) = &self.coverage_counters.bcb_counters[bcb] { debug!("{bcb:?} already has a counter: {counter_kind:?}"); @@ -384,11 +377,10 @@ impl<'a> MakeBcbCounters<'a> { let mut predecessors = self.bcb_predecessors(bcb).to_owned().into_iter(); debug!("{bcb:?} has multiple incoming edges and will need a sum-up expression"); let first_edge_counter_operand = - self.recursive_get_or_make_edge_counter_operand(predecessors.next().unwrap(), bcb)?; + self.get_or_make_edge_counter_operand(predecessors.next().unwrap(), bcb)?; let mut some_sumup_edge_counter_operand = None; for predecessor in predecessors { - let edge_counter_operand = - self.recursive_get_or_make_edge_counter_operand(predecessor, bcb)?; + let edge_counter_operand = self.get_or_make_edge_counter_operand(predecessor, bcb)?; if let Some(sumup_edge_counter_operand) = some_sumup_edge_counter_operand.replace(edge_counter_operand) { @@ -411,16 +403,8 @@ impl<'a> MakeBcbCounters<'a> { self.coverage_counters.set_bcb_counter(bcb, counter_kind) } - fn get_or_make_edge_counter_operand( - &mut self, - from_bcb: BasicCoverageBlock, - to_bcb: BasicCoverageBlock, - ) -> Result<CovTerm, Error> { - self.recursive_get_or_make_edge_counter_operand(from_bcb, to_bcb) - } - #[instrument(level = "debug", skip(self))] - fn recursive_get_or_make_edge_counter_operand( + fn get_or_make_edge_counter_operand( &mut self, from_bcb: BasicCoverageBlock, to_bcb: BasicCoverageBlock, @@ -429,7 +413,7 @@ impl<'a> MakeBcbCounters<'a> { // counter is unnecessary. Just get or make a counter for the source BCB. let successors = self.bcb_successors(from_bcb).iter(); if successors.len() == 1 { - return self.recursive_get_or_make_counter_operand(from_bcb); + return self.get_or_make_counter_operand(from_bcb); } // If the edge already has a counter, return it. |
