Skip to content

Commit

Permalink
Add impl PartialEq<Error> for util::Error, making == commutative …
Browse files Browse the repository at this point in the history
…over `data::Error` and `util::Error`
  • Loading branch information
regexident committed Jan 4, 2023
1 parent 83f2d1b commit 99037ca
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions data/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,12 @@ impl PartialEq<util::Error> for Error {
false
}
}

impl PartialEq<Error> for util::Error {
fn eq(&self, other: &Error) -> bool {
if let Some(down) = self.downcast_ref::<Error>() {
return other == down;
}
false
}
}

0 comments on commit 99037ca

Please sign in to comment.