1
0
Fork 0
mirror of https://forgejo.ellis.link/continuwuation/continuwuity.git synced 2025-07-29 03:08:31 +00:00

move infallible handling into error

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-07-12 20:13:55 +00:00
parent 4cc92dd175
commit 4600c7f32d
3 changed files with 19 additions and 18 deletions

View file

@ -196,7 +196,11 @@ impl UnwindSafe for Error {}
impl RefUnwindSafe for Error {}
impl From<Infallible> for Error {
fn from(i: Infallible) -> Self { match i {} }
#[cold]
#[inline(never)]
fn from(_i: Infallible) -> Self {
panic!("infallible error should never exist");
}
}
impl fmt::Debug for Error {
@ -273,6 +277,12 @@ pub fn inspect_debug_log<E: fmt::Debug>(error: &E) {
debug_error!("{error:?}");
}
#[cold]
#[inline(never)]
pub fn infallible(_e: &Infallible) {
panic!("infallible error should never exist");
}
impl axum::response::IntoResponse for Error {
fn into_response(self) -> axum::response::Response {
let response: UiaaResponse = self.into();