about summary refs log tree commit diff
path: root/compiler/rustc_mir/src/transform/coverage/graph.rs
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2021-08-05 05:36:38 +0200
committerest31 <MTest31@outlook.com>2021-08-18 09:31:51 +0200
commit99db8fa9c2b034986242615559b5435cd3a5f97b (patch)
treefe498d87b6598c6a6f7b9fc177a769c14ccd98e7 /compiler/rustc_mir/src/transform/coverage/graph.rs
parentdcdadc4d8d905065eaa88245010585cbfbb6cc92 (diff)
downloadrust-99db8fa9c2b034986242615559b5435cd3a5f97b.tar.gz
rust-99db8fa9c2b034986242615559b5435cd3a5f97b.zip
Remove box syntax from rustc_mir
Diffstat (limited to 'compiler/rustc_mir/src/transform/coverage/graph.rs')
-rw-r--r--compiler/rustc_mir/src/transform/coverage/graph.rs22
1 files changed, 13 insertions, 9 deletions
diff --git a/compiler/rustc_mir/src/transform/coverage/graph.rs b/compiler/rustc_mir/src/transform/coverage/graph.rs
index 32febcec7af..d78ad6ce97f 100644
--- a/compiler/rustc_mir/src/transform/coverage/graph.rs
+++ b/compiler/rustc_mir/src/transform/coverage/graph.rs
@@ -491,15 +491,19 @@ fn bcb_filtered_successors<'a, 'tcx>(
     term_kind: &'tcx TerminatorKind<'tcx>,
 ) -> Box<dyn Iterator<Item = &'a BasicBlock> + 'a> {
     let mut successors = term_kind.successors();
-    box match &term_kind {
-        // SwitchInt successors are never unwind, and all of them should be traversed.
-        TerminatorKind::SwitchInt { .. } => successors,
-        // For all other kinds, return only the first successor, if any, and ignore unwinds.
-        // NOTE: `chain(&[])` is required to coerce the `option::iter` (from
-        // `next().into_iter()`) into the `mir::Successors` aliased type.
-        _ => successors.next().into_iter().chain(&[]),
-    }
-    .filter(move |&&successor| body[successor].terminator().kind != TerminatorKind::Unreachable)
+    Box::new(
+        match &term_kind {
+            // SwitchInt successors are never unwind, and all of them should be traversed.
+            TerminatorKind::SwitchInt { .. } => successors,
+            // For all other kinds, return only the first successor, if any, and ignore unwinds.
+            // NOTE: `chain(&[])` is required to coerce the `option::iter` (from
+            // `next().into_iter()`) into the `mir::Successors` aliased type.
+            _ => successors.next().into_iter().chain(&[]),
+        }
+        .filter(move |&&successor| {
+            body[successor].terminator().kind != TerminatorKind::Unreachable
+        }),
+    )
 }
 
 /// Maintains separate worklists for each loop in the BasicCoverageBlock CFG, plus one for the