Skip to content

Commit 5ceb1b3

Browse files
committed
Implement Eq and PartialEq for Error.
1 parent f913693 commit 5ceb1b3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/errors.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub(crate) fn new_error(kind: ErrorKind) -> Error {
1111
pub type Result<T> = result::Result<T, Error>;
1212

1313
/// An error that can occur when encoding/decoding JWTs
14-
#[derive(Debug)]
14+
#[derive(Debug, Eq, PartialEq)]
1515
pub struct Error(Box<ErrorKind>);
1616

1717
impl Error {
@@ -133,6 +133,9 @@ impl PartialEq for ErrorKind {
133133
}
134134
}
135135

136+
// Equality of ErrorKind is an equivalence relation: it is reflexive, symmetric and transitive.
137+
impl Eq for ErrorKind {}
138+
136139
impl From<base64::DecodeError> for Error {
137140
fn from(err: base64::DecodeError) -> Error {
138141
new_error(ErrorKind::Base64(err))

0 commit comments

Comments
 (0)