Bug 1773733 - Fill in reasons for unreachable panics; r=nordzilla

Differential Revision: https://phabricator.services.mozilla.com/D159441
This commit is contained in:
Greg Tatum 2022-10-19 21:17:29 +00:00
Родитель 6b697478cc
Коммит 8dc7797215
2 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -68,21 +68,21 @@ impl<P, B> State<P, B> {
match self {
Self::Locale(locale) => locale,
Self::Solver { locale, .. } => locale,
Self::Empty => unreachable!(),
Self::Empty => unreachable!("Attempting to get a locale for an empty state."),
}
}
fn take_solver(&mut self) -> ParallelProblemSolver<GenerateBundles<P, B>> {
replace_with::replace_with_or_default_and_return(self, |self_| match self_ {
Self::Solver { locale, solver } => (solver, Self::Locale(locale)),
_ => unreachable!(),
_ => unreachable!("Attempting to take a solver in an invalid state."),
})
}
fn put_back_solver(&mut self, solver: ParallelProblemSolver<GenerateBundles<P, B>>) {
replace_with::replace_with_or_default(self, |self_| match self_ {
Self::Locale(locale) => Self::Solver { locale, solver },
_ => unreachable!(),
_ => unreachable!("Attempting to put back a solver in an invalid state."),
})
}
}

Просмотреть файл

@ -99,21 +99,21 @@ impl State {
match self {
Self::Locale(locale) => locale,
Self::Solver { locale, .. } => locale,
Self::Empty => unreachable!(),
Self::Empty => unreachable!("Attempting to get a locale for an empty state."),
}
}
fn take_solver(&mut self) -> SerialProblemSolver {
replace_with::replace_with_or_default_and_return(self, |self_| match self_ {
Self::Solver { locale, solver } => (solver, Self::Locale(locale)),
_ => unreachable!(),
_ => unreachable!("Attempting to take a solver in an invalid state."),
})
}
fn put_back_solver(&mut self, solver: SerialProblemSolver) {
replace_with::replace_with_or_default(self, |self_| match self_ {
Self::Locale(locale) => Self::Solver { locale, solver },
_ => unreachable!(),
_ => unreachable!("Attempting to put back a solver in an invalid state."),
})
}
}