From 36d97ee509b8d48872d8425c040348df3ffa3dc5 Mon Sep 17 00:00:00 2001 From: tottoto Date: Fri, 6 Sep 2024 09:04:48 +0900 Subject: [PATCH] feat(util): allow Empty constructor in const context --- http-body-util/src/empty.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/http-body-util/src/empty.rs b/http-body-util/src/empty.rs index d1445b4..e39a4ee 100644 --- a/http-body-util/src/empty.rs +++ b/http-body-util/src/empty.rs @@ -15,8 +15,10 @@ pub struct Empty { impl Empty { /// Create a new `Empty`. - pub fn new() -> Self { - Self::default() + pub const fn new() -> Self { + Self { + _marker: PhantomData, + } } } @@ -49,9 +51,7 @@ impl fmt::Debug for Empty { impl Default for Empty { fn default() -> Self { - Self { - _marker: PhantomData, - } + Self::new() } }