[librsvg: 30/32] HrefError and DefsLookupErrorKind don't need to be PartialEq




commit d9d046fd47d21946c62b79a471e63b7b4c560ff1
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Dec 3 19:53:22 2020 -0600

    HrefError and DefsLookupErrorKind don't need to be PartialEq

 src/error.rs        |  4 ++--
 src/url_resolver.rs | 11 +++++++----
 2 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/error.rs b/src/error.rs
index 6fe6d35b..c65eca50 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -86,7 +86,7 @@ impl fmt::Display for ElementError {
 }
 
 /// Errors returned when looking up a resource by URL reference.
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone)]
 pub enum DefsLookupErrorKind {
     /// Error when parsing an [`Href`].
     ///
@@ -278,7 +278,7 @@ impl<'i, O> AttributeResultExt<O> for Result<O, ParseError<'i>> {
 }
 
 /// Errors returned when creating an `Href` out of a string
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone)]
 pub enum HrefError {
     /// The href is an invalid URI or has empty components.
     ParseError,
diff --git a/src/url_resolver.rs b/src/url_resolver.rs
index 3a3d749e..928135d8 100644
--- a/src/url_resolver.rs
+++ b/src/url_resolver.rs
@@ -363,9 +363,9 @@ mod tests {
             ))
         );
 
-        assert_eq!(Href::parse(""), Err(HrefError::ParseError));
-        assert_eq!(Href::parse("#"), Err(HrefError::ParseError));
-        assert_eq!(Href::parse("uri#"), Err(HrefError::ParseError));
+        assert!(matches!(Href::parse(""), Err(HrefError::ParseError)));
+        assert!(matches!(Href::parse("#"), Err(HrefError::ParseError)));
+        assert!(matches!(Href::parse("uri#"), Err(HrefError::ParseError)));
     }
 
     #[test]
@@ -380,6 +380,9 @@ mod tests {
             Fragment::new(Some("uri".to_string()), "foo".to_string())
         );
 
-        assert_eq!(Fragment::parse("uri"), Err(HrefError::FragmentRequired));
+        assert!(matches!(
+            Fragment::parse("uri"),
+            Err(HrefError::FragmentRequired)
+        ));
     }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]