From d2c8ae3f1143b3a3dd115bb55827c028ba28c1a5 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Fri, 19 Feb 2021 21:13:20 +0100 Subject: [PATCH] Impl PartialEq for ErrorKind Closes #125 --- src/decoding.rs | 1 - src/errors.rs | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/decoding.rs b/src/decoding.rs index 22ccf0d..a55bf6a 100644 --- a/src/decoding.rs +++ b/src/decoding.rs @@ -262,7 +262,6 @@ pub fn dangerous_insecure_decode_with_validation( Ok(TokenData { header, claims: decoded_claims }) } - /// Decode a JWT without any signature verification/validations and return its [Header](struct.Header.html). /// /// If the token has an invalid format (ie 3 parts separated by a `.`), it will return an error. diff --git a/src/errors.rs b/src/errors.rs index 403afe3..c78253a 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -123,6 +123,12 @@ impl fmt::Display for Error { } } +impl PartialEq for ErrorKind { + fn eq(&self, other: &Self) -> bool { + format!("{:?}", self) == format!("{:?}", other) + } +} + impl From for Error { fn from(err: base64::DecodeError) -> Error { new_error(ErrorKind::Base64(err))