diff --git a/crates/common/src/protocol/jwt.rs b/crates/common/src/protocol/jwt.rs index 256595fec..9ca567b96 100644 --- a/crates/common/src/protocol/jwt.rs +++ b/crates/common/src/protocol/jwt.rs @@ -146,20 +146,7 @@ impl FromStr for KeyId { } } -impl TryFrom for KeyId { - type Error = InvalidKeyId; - /// Validates owned text, as serde reads it. - fn try_from(value: String) -> Result { - value.parse() - } -} - -impl From for String { - /// The identifier unchanged. - fn from(value: KeyId) -> Self { - value.0 - } -} +text_conversions!(KeyId); impl fmt::Display for KeyId { /// Writes the identifier unchanged. diff --git a/crates/common/src/protocol/oauth.rs b/crates/common/src/protocol/oauth.rs index 787914169..e36e117bb 100644 --- a/crates/common/src/protocol/oauth.rs +++ b/crates/common/src/protocol/oauth.rs @@ -419,20 +419,7 @@ impl FromStr for ErrorDescription { } } -impl TryFrom for ErrorDescription { - type Error = InvalidDescription; - /// Same as `parse`. - fn try_from(text: String) -> Result { - text.parse() - } -} - -impl From for String { - /// The description text. - fn from(description: ErrorDescription) -> Self { - description.0 - } -} +text_conversions!(ErrorDescription); impl fmt::Display for ErrorDescription { /// Writes the description.