From 436a5aad579f7f9e0053ec4fc35c068baf148d64 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Mon, 9 Sep 2019 17:23:11 -0700 Subject: [PATCH] Deprecate 'Result, E: !Responder' responder. --- core/lib/src/response/responder.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/lib/src/response/responder.rs b/core/lib/src/response/responder.rs index 5e6937e5..1e33d4de 100644 --- a/core/lib/src/response/responder.rs +++ b/core/lib/src/response/responder.rs @@ -271,10 +271,17 @@ impl<'r, R: Responder<'r>> Responder<'r> for Option { /// If `self` is `Ok`, responds with the wrapped `Responder`. Otherwise prints /// an error message with the `Err` value returns an `Err` of /// `Status::InternalServerError`. +#[deprecated(since = "0.4.3")] impl<'r, R: Responder<'r>, E: fmt::Debug> Responder<'r> for Result { default fn respond_to(self, req: &Request) -> response::Result<'r> { self.map(|r| r.respond_to(req)).unwrap_or_else(|e| { error_!("Response was a non-`Responder` `Err`: {:?}.", e); + warn_!("This `Responder` implementation has been deprecated."); + warn_!( + "In Rocket v0.5, `Result` implements `Responder` only if \ + `E` implements `Responder`. For the previous behavior, use \ + `Result>` where `Debug` is `rocket::response::Debug`." + ); Err(Status::InternalServerError) }) }