mirror of https://github.com/fafhrd91/actix-web
use boxed trait method where appropriate
This commit is contained in:
parent
88a1999c06
commit
240c85260b
|
@ -194,7 +194,7 @@ impl<B> Response<B> {
|
|||
where
|
||||
B: MessageBody + 'static,
|
||||
{
|
||||
self.map_body(|_, body| BoxBody::new(body))
|
||||
self.map_body(|_, body| body.boxed())
|
||||
}
|
||||
|
||||
/// Returns body, consuming this response.
|
||||
|
|
|
@ -45,9 +45,7 @@ impl AnyBody {
|
|||
where
|
||||
B: MessageBody + 'static,
|
||||
{
|
||||
Self::Body {
|
||||
body: BoxBody::new(body),
|
||||
}
|
||||
Self::Body { body: body.boxed() }
|
||||
}
|
||||
|
||||
/// Constructs new `AnyBody` instance from a slice of bytes by copying it.
|
||||
|
|
|
@ -244,8 +244,7 @@ impl<B> HttpResponse<B> {
|
|||
where
|
||||
B: MessageBody + 'static,
|
||||
{
|
||||
// TODO: avoid double boxing with down-casting, if it improves perf
|
||||
self.map_body(|_, body| BoxBody::new(body))
|
||||
self.map_body(|_, body| body.boxed())
|
||||
}
|
||||
|
||||
/// Extract response body
|
||||
|
|
|
@ -451,7 +451,7 @@ impl<B> ServiceResponse<B> {
|
|||
where
|
||||
B: MessageBody + 'static,
|
||||
{
|
||||
self.map_body(|_, body| BoxBody::new(body))
|
||||
self.map_body(|_, body| body.boxed())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue