Add `std::convert::Infallible` implementantion for `ResponseError`

This commit is contained in:
nWacky 2019-09-16 15:58:22 +03:00
parent c1f99e0775
commit 20e8c9ebfa
1 changed files with 8 additions and 0 deletions

View File

@ -158,6 +158,14 @@ impl<E: ResponseError> ResponseError for TimeoutError<E> {
}
}
/// Return `INTERNAL_SERVER_ERROR` for `std::convert::Infallible`
impl ResponseError for std::convert::Infallible {
fn error_response(&self) -> Response {
// `std::convert::Infallible` should never happen
unreachable!()
}
}
#[derive(Debug, Display)]
#[display(fmt = "UnknownError")]
struct UnitError;