From eb7f404cf497fcaec46f72f5faa8e15b5b0f9748 Mon Sep 17 00:00:00 2001 From: John Howard Date: Fri, 10 Mar 2023 11:00:50 -0800 Subject: [PATCH 1/2] body: add Default impl when underlying type is Default --- src/body.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/body.rs b/src/body.rs index 66fb3c6..2dd531c 100644 --- a/src/body.rs +++ b/src/body.rs @@ -169,3 +169,9 @@ where self.body.is_end_stream() } } + +impl Default for HttpBody1ToHttpBody04 { + fn default() -> Self { + HttpBody1ToHttpBody04::new(B::default()) + } +} From f2fbc0895bb8e8c83100e8e42ce72a8d8efaf85f Mon Sep 17 00:00:00 2001 From: John Howard Date: Mon, 13 Mar 2023 08:19:22 -0700 Subject: [PATCH 2/2] Use Derive --- src/body.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/body.rs b/src/body.rs index 2dd531c..a1879fd 100644 --- a/src/body.rs +++ b/src/body.rs @@ -78,7 +78,7 @@ pin_project! { /// /// [http-body 0.4 `Body`]: https://docs.rs/http-body/latest/http_body/trait.Body.html /// [http-body 1.0 `Body`]: https://docs.rs/http-body/1.0.0-rc.2/http_body/trait.Body.html - #[derive(Debug, Clone)] + #[derive(Debug, Clone, Default)] pub struct HttpBody1ToHttpBody04 { #[pin] body: B, @@ -169,9 +169,3 @@ where self.body.is_end_stream() } } - -impl Default for HttpBody1ToHttpBody04 { - fn default() -> Self { - HttpBody1ToHttpBody04::new(B::default()) - } -}