diff --git a/compiler/stable_mir/src/mir/body.rs b/compiler/stable_mir/src/mir/body.rs index 8ccc6732a8d..3a4f4283562 100644 --- a/compiler/stable_mir/src/mir/body.rs +++ b/compiler/stable_mir/src/mir/body.rs @@ -672,10 +672,7 @@ pub struct SwitchTargets { impl SwitchTargets { /// All possible targets including the `otherwise` target. pub fn all_targets(&self) -> Successors { - Some(self.otherwise) - .into_iter() - .chain(self.branches.iter().map(|(_, target)| *target)) - .collect() + self.branches.iter().map(|(_, target)| *target).chain(Some(self.otherwise)).collect() } /// The `otherwise` branch target.