1
Fork 0

Fix SwitchTarget pretty print

We currently rely on the order of successors to be conditional branches
first, followed by the otherwise target.
This commit is contained in:
Celina G. Val 2023-11-30 11:40:55 -08:00
parent 3e0b2fac5d
commit 9d2c92377d

View file

@ -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.