From 7bb7adf89c912ea4a80d8fde0026d6f838a6ac0a Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Sat, 20 Jan 2018 22:02:42 -0800 Subject: [PATCH] relax InternalError constraints --- guide/src/qs_4_5.md | 3 +-- src/error.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/guide/src/qs_4_5.md b/guide/src/qs_4_5.md index 18bf7ed6..5a11af73 100644 --- a/guide/src/qs_4_5.md +++ b/guide/src/qs_4_5.md @@ -116,8 +116,7 @@ specific error response. We can use helper types for first example with custom e #[macro_use] extern crate failure; use actix_web::*; -#[derive(Fail, Debug)] -#[fail(display="Error {}", name)] +#[derive(Debug)] struct MyError { name: &'static str } diff --git a/src/error.rs b/src/error.rs index 7d821307..08424921 100644 --- a/src/error.rs +++ b/src/error.rs @@ -531,7 +531,7 @@ impl InternalError { } impl Fail for InternalError - where T: Send + Sync + fmt::Display + fmt::Debug + 'static + where T: Send + Sync + fmt::Debug + 'static { fn backtrace(&self) -> Option<&Backtrace> { Some(&self.backtrace) @@ -539,7 +539,7 @@ impl Fail for InternalError } impl fmt::Debug for InternalError - where T: Send + Sync + fmt::Display + fmt::Debug + 'static + where T: Send + Sync + fmt::Debug + 'static { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt(&self.cause, f) @@ -547,15 +547,15 @@ impl fmt::Debug for InternalError } impl fmt::Display for InternalError - where T: Send + Sync + fmt::Display + fmt::Debug + 'static + where T: Send + Sync + fmt::Debug + 'static { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::Display::fmt(&self.cause, f) + fmt::Debug::fmt(&self.cause, f) } } impl ResponseError for InternalError - where T: Send + Sync + fmt::Display + fmt::Debug + 'static + where T: Send + Sync + fmt::Debug + 'static { fn error_response(&self) -> HttpResponse { HttpResponse::new(self.status, Body::Empty) @@ -563,7 +563,7 @@ impl ResponseError for InternalError } impl Responder for InternalError - where T: Send + Sync + fmt::Display + fmt::Debug + 'static + where T: Send + Sync + fmt::Debug + 'static { type Item = HttpResponse; type Error = Error;