Remove unnecessary boxing

This commit is contained in:
Valentin Brandl 2019-08-02 23:54:35 +02:00
parent ced6c7dc46
commit 7e90aec5d9
No known key found for this signature in database
GPG Key ID: 30D341DD34118D7D

View File

@ -81,7 +81,7 @@ pub(crate) trait Service {
where where
S: 'static + Stream<Item = Bytes, Error = PayloadError>, S: 'static + Stream<Item = Bytes, Error = PayloadError>,
{ {
Box::new(match response.status() { match response.status() {
StatusCode::OK => Box::new( StatusCode::OK => Box::new(
response response
.json::<Self::Response>() .json::<Self::Response>()
@ -103,7 +103,7 @@ pub(crate) trait Service {
) as Box<dyn Future<Item = HttpResponse, Error = Error>>, ) as Box<dyn Future<Item = HttpResponse, Error = Error>>,
code => Box::new(futures::future::ok(HttpResponse::build(code).finish())) code => Box::new(futures::future::ok(HttpResponse::build(code).finish()))
as Box<dyn Future<Item = HttpResponse, Error = Error>>, as Box<dyn Future<Item = HttpResponse, Error = Error>>,
}) }
} }
} }
@ -213,7 +213,7 @@ impl Service for GitLab {
where where
S: 'static + Stream<Item = Bytes, Error = PayloadError>, S: 'static + Stream<Item = Bytes, Error = PayloadError>,
{ {
Box::new(match response.status() { match response.status() {
StatusCode::OK => Box::new( StatusCode::OK => Box::new(
response response
.json::<GitLabProject>() .json::<GitLabProject>()
@ -258,6 +258,6 @@ impl Service for GitLab {
) as Box<dyn Future<Item = HttpResponse, Error = Error>>, ) as Box<dyn Future<Item = HttpResponse, Error = Error>>,
code => Box::new(futures::future::ok(HttpResponse::build(code).finish())) code => Box::new(futures::future::ok(HttpResponse::build(code).finish()))
as Box<dyn Future<Item = HttpResponse, Error = Error>>, as Box<dyn Future<Item = HttpResponse, Error = Error>>,
}) }
} }
} }