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()) } }