Keats / jsonwebtoken

JWT lib in rust
MIT License
1.69k stars 271 forks source link

Implement PartialEq on ErrorKind #125

Closed jamesjmeyer210 closed 2 years ago

jamesjmeyer210 commented 4 years ago

I've started using this crate for a web service. Upon writing unit tests for some code I'd implemented around this crate, I quickly discovered PartialEq is not implemented on the ErrorKind enum. If it were implemented this would really make the tests a lot cleaner because the users of this crate wouldn't have to convert the errors to String/str for assert_eq! or assert_ne!

Keats commented 4 years ago

I don't think it can be implemented due to some error wrapping. I could be wrong though

jamesjmeyer210 commented 4 years ago

Working with the strings isn't the end of the world, but I wouldn't be surprised if the missing PartialEq cascaded back on dependencies.

platy commented 4 years ago

The non-PartialEq wrapped error is serde_json which wraps std::io::Error which is not PartialEq https://github.com/serde-rs/json/issues/271

Keats commented 4 years ago

I'll take a PR for it