From effe1bdbff08a613b1dce7a0b2cfe11a7983ef4b Mon Sep 17 00:00:00 2001 From: Frederik Rothenberger Date: Tue, 17 Sep 2024 13:32:43 +0200 Subject: [PATCH] Split implementation of Display --- identity_jose/src/jws/algorithm.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/identity_jose/src/jws/algorithm.rs b/identity_jose/src/jws/algorithm.rs index 9601a6842..1d6b1c319 100644 --- a/identity_jose/src/jws/algorithm.rs +++ b/identity_jose/src/jws/algorithm.rs @@ -149,8 +149,16 @@ impl FromStr for JwsAlgorithm { } } +#[cfg(not(feature = "custom_alg"))] impl Display for JwsAlgorithm { fn fmt(&self, f: &mut Formatter<'_>) -> Result { - f.write_str(&self.clone().name()) + f.write_str(self.name()) + } +} + +#[cfg(feature = "custom_alg")] +impl Display for JwsAlgorithm { + fn fmt(&self, f: &mut Formatter<'_>) -> Result { + f.write_str(&(*self).name()) } }