File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 55- Add ` ServiceRequest::extract() ` to make it easier to use extractors when writing middlewares. [ #2647 ]
66- Add ` Route::wrap() ` to allow individual routes to use middleware. [ #2725 ]
77- Add ` ServiceConfig::default_service() ` . [ #2338 ] [ #2743 ]
8+ - Implement ` ResponseError ` for ` std::convert::Infallible `
89
910### Fixed
1011- Clear connection-level data on ` HttpRequest ` drop. [ #2742 ]
Original file line number Diff line number Diff line change @@ -51,12 +51,6 @@ impl StdError for Error {
5151 }
5252}
5353
54- impl From < std:: convert:: Infallible > for Error {
55- fn from ( val : std:: convert:: Infallible ) -> Self {
56- match val { }
57- }
58- }
59-
6054/// `Error` for any error that implements `ResponseError`
6155impl < T : ResponseError + ' static > From < T > for Error {
6256 fn from ( err : T ) -> Error {
Original file line number Diff line number Diff line change 11//! `ResponseError` trait and foreign impls.
22
33use std:: {
4+ convert:: Infallible ,
45 error:: Error as StdError ,
56 fmt,
67 io:: { self , Write as _} ,
@@ -54,6 +55,15 @@ downcast_dyn!(ResponseError);
5455
5556impl ResponseError for Box < dyn StdError + ' static > { }
5657
58+ impl ResponseError for Infallible {
59+ fn status_code ( & self ) -> StatusCode {
60+ match * self { }
61+ }
62+ fn error_response ( & self ) -> HttpResponse < BoxBody > {
63+ match * self { }
64+ }
65+ }
66+
5767#[ cfg( feature = "openssl" ) ]
5868impl ResponseError for actix_tls:: accept:: openssl:: reexports:: Error { }
5969
You can’t perform that action at this time.
0 commit comments