Add from `std::convert::Infallible` to `Error`

This commit is contained in:
nWacky 2019-09-16 16:46:16 +03:00
parent c1f99e0775
commit ef134779d8
1 changed files with 8 additions and 0 deletions

View File

@ -132,6 +132,14 @@ impl std::error::Error for Error {
} }
} }
/// Convert `INTERNAL_SERVER_ERROR` to `std::convert::Infallible`
impl From<std::convert::Infallible> for Error {
fn from(_: std::convert::Infallible) -> Self {
// `std::convert::Infallible` should never happen
unreachable!()
}
}
/// Convert `Error` to a `Response` instance /// Convert `Error` to a `Response` instance
impl From<Error> for Response { impl From<Error> for Response {
fn from(err: Error) -> Self { fn from(err: Error) -> Self {