[librsvg: 29/32] ValueErrorKind should not be PartialEq




commit c235f210f27b187d1c1e28d50c547120d7ae25f0
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Dec 3 19:47:36 2020 -0600

    ValueErrorKind should not be PartialEq
    
    I think it was only because tests were like this all over the place:
    
       assert_eq!(
         some_parser("foo"),
         Ok(Foo(some_value))
       );
    
    Instead of the more conventional
    
       assert_eq!(
         some_parser("foo").unwrap(),
         Foo(some_value)
       );
    
    Having the Ok() inside assert_eq, as in the first case, requires both
    type parameters in Result<T, E> to be PartialEq.

 src/angle.rs           | 15 +++++----
 src/aspect_ratio.rs    | 40 ++++++++++++------------
 src/cond.rs            | 56 +++++++++++++++++----------------
 src/coord_units.rs     |  8 ++---
 src/error.rs           |  4 +--
 src/filter.rs          |  7 ++---
 src/font_props.rs      | 84 +++++++++++++++++++++++---------------------------
 src/gradient.rs        | 11 ++++---
 src/iri.rs             | 24 ++++++---------
 src/length.rs          | 40 ++++++++++++------------
 src/marker.rs          | 30 +++++++++---------
 src/number_list.rs     | 16 +++++-----
 src/paint_server.rs    | 42 ++++++++++++-------------
 src/parsers.rs         | 56 ++++++++++++++++-----------------
 src/property_macros.rs |  2 +-
 src/shapes.rs          | 25 ++++++++-------
 src/style.rs           |  2 +-
 src/unit_interval.rs   | 10 +++---
 src/viewbox.rs         |  8 ++---
 19 files changed, 239 insertions(+), 241 deletions(-)
---
diff --git a/src/angle.rs b/src/angle.rs
index 182b5b7c..98835d46 100644
--- a/src/angle.rs
+++ b/src/angle.rs
@@ -104,13 +104,16 @@ mod tests {
 
     #[test]
     fn parses_angle() {
-        assert_eq!(Angle::parse_str("0"), Ok(Angle::new(0.0)));
-        assert_eq!(Angle::parse_str("15"), Ok(Angle::from_degrees(15.0)));
-        assert_eq!(Angle::parse_str("180.5deg"), Ok(Angle::from_degrees(180.5)));
-        assert_eq!(Angle::parse_str("1rad"), Ok(Angle::new(1.0)));
+        assert_eq!(Angle::parse_str("0").unwrap(), Angle::new(0.0));
+        assert_eq!(Angle::parse_str("15").unwrap(), Angle::from_degrees(15.0));
         assert_eq!(
-            Angle::parse_str("-400grad"),
-            Ok(Angle::from_degrees(-360.0))
+            Angle::parse_str("180.5deg").unwrap(),
+            Angle::from_degrees(180.5)
+        );
+        assert_eq!(Angle::parse_str("1rad").unwrap(), Angle::new(1.0));
+        assert_eq!(
+            Angle::parse_str("-400grad").unwrap(),
+            Angle::from_degrees(-360.0)
         );
 
         assert!(Angle::parse_str("").is_err());
diff --git a/src/aspect_ratio.rs b/src/aspect_ratio.rs
index a9ffa087..fd0a8ecb 100644
--- a/src/aspect_ratio.rs
+++ b/src/aspect_ratio.rs
@@ -7,8 +7,8 @@
 //! # use librsvg::doctest_only::AspectRatio;
 //! # use librsvg::doctest_only::Parse;
 //! assert_eq!(
-//!     AspectRatio::parse_str("xMidYMid"),
-//!     Ok(AspectRatio::default())
+//!     AspectRatio::parse_str("xMidYMid").unwrap(),
+//!     AspectRatio::default()
 //! );
 //! ```
 //!
@@ -260,71 +260,71 @@ mod tests {
     #[test]
     fn parses_valid_strings() {
         assert_eq!(
-            AspectRatio::parse_str("defer none"),
-            Ok(AspectRatio {
+            AspectRatio::parse_str("defer none").unwrap(),
+            AspectRatio {
                 defer: true,
                 align: None,
-            },)
+            }
         );
 
         assert_eq!(
-            AspectRatio::parse_str("xMidYMid"),
-            Ok(AspectRatio {
+            AspectRatio::parse_str("xMidYMid").unwrap(),
+            AspectRatio {
                 defer: false,
                 align: Some(Align {
                     x: X(Align1D::Mid),
                     y: Y(Align1D::Mid),
                     fit: FitMode::Meet,
                 },),
-            },)
+            }
         );
 
         assert_eq!(
-            AspectRatio::parse_str("defer xMidYMid"),
-            Ok(AspectRatio {
+            AspectRatio::parse_str("defer xMidYMid").unwrap(),
+            AspectRatio {
                 defer: true,
                 align: Some(Align {
                     x: X(Align1D::Mid),
                     y: Y(Align1D::Mid),
                     fit: FitMode::Meet,
                 },),
-            },)
+            }
         );
 
         assert_eq!(
-            AspectRatio::parse_str("defer xMinYMax"),
-            Ok(AspectRatio {
+            AspectRatio::parse_str("defer xMinYMax").unwrap(),
+            AspectRatio {
                 defer: true,
                 align: Some(Align {
                     x: X(Align1D::Min),
                     y: Y(Align1D::Max),
                     fit: FitMode::Meet,
                 },),
-            },)
+            }
         );
 
         assert_eq!(
-            AspectRatio::parse_str("defer xMaxYMid meet"),
-            Ok(AspectRatio {
+            AspectRatio::parse_str("defer xMaxYMid meet").unwrap(),
+            AspectRatio {
                 defer: true,
                 align: Some(Align {
                     x: X(Align1D::Max),
                     y: Y(Align1D::Mid),
                     fit: FitMode::Meet,
                 },),
-            },)
+            }
         );
 
         assert_eq!(
-            AspectRatio::parse_str("defer xMinYMax slice"),
-            Ok(AspectRatio {
+            AspectRatio::parse_str("defer xMinYMax slice").unwrap(),
+            AspectRatio {
                 defer: true,
                 align: Some(Align {
                     x: X(Align1D::Min),
                     y: Y(Align1D::Max),
                     fit: FitMode::Slice,
                 },),
-            },)
+            }
         );
     }
 
diff --git a/src/cond.rs b/src/cond.rs
index 25117c69..f3edcc2c 100644
--- a/src/cond.rs
+++ b/src/cond.rs
@@ -149,37 +149,41 @@ mod tests {
     #[test]
     fn required_extensions() {
         assert_eq!(
-            RequiredExtensions::from_attribute("http://test.org/NotExisting/1.0";),
-            Ok(RequiredExtensions(false))
+            RequiredExtensions::from_attribute("http://test.org/NotExisting/1.0";).unwrap(),
+            RequiredExtensions(false)
         );
     }
 
     #[test]
     fn required_features() {
         assert_eq!(
-            RequiredFeatures::from_attribute("http://www.w3.org/TR/SVG11/feature#NotExisting";),
-            Ok(RequiredFeatures(false))
+            RequiredFeatures::from_attribute("http://www.w3.org/TR/SVG11/feature#NotExisting";)
+                .unwrap(),
+            RequiredFeatures(false)
         );
 
         assert_eq!(
-            RequiredFeatures::from_attribute("http://www.w3.org/TR/SVG11/feature#BasicFilter";),
-            Ok(RequiredFeatures(true))
+            RequiredFeatures::from_attribute("http://www.w3.org/TR/SVG11/feature#BasicFilter";)
+                .unwrap(),
+            RequiredFeatures(true)
         );
 
         assert_eq!(
             RequiredFeatures::from_attribute(
                 "http://www.w3.org/TR/SVG11/feature#BasicFilter \
                  http://www.w3.org/TR/SVG11/feature#NotExisting";,
-            ),
-            Ok(RequiredFeatures(false))
+            )
+            .unwrap(),
+            RequiredFeatures(false)
         );
 
         assert_eq!(
             RequiredFeatures::from_attribute(
                 "http://www.w3.org/TR/SVG11/feature#BasicFilter \
                  http://www.w3.org/TR/SVG11/feature#BasicText";,
-            ),
-            Ok(RequiredFeatures(true))
+            )
+            .unwrap(),
+            RequiredFeatures(true)
         );
     }
 
@@ -192,43 +196,43 @@ mod tests {
         assert!(SystemLanguage::from_attribute("12345", &user_prefers).is_err());
 
         assert_eq!(
-            SystemLanguage::from_attribute("fr", &user_prefers),
-            Ok(SystemLanguage(false))
+            SystemLanguage::from_attribute("fr", &user_prefers).unwrap(),
+            SystemLanguage(false)
         );
 
         assert_eq!(
-            SystemLanguage::from_attribute("en", &user_prefers),
-            Ok(SystemLanguage(false))
+            SystemLanguage::from_attribute("en", &user_prefers).unwrap(),
+            SystemLanguage(false)
         );
 
         assert_eq!(
-            SystemLanguage::from_attribute("de", &user_prefers),
-            Ok(SystemLanguage(true))
+            SystemLanguage::from_attribute("de", &user_prefers).unwrap(),
+            SystemLanguage(true)
         );
 
         assert_eq!(
-            SystemLanguage::from_attribute("en-US", &user_prefers),
-            Ok(SystemLanguage(true))
+            SystemLanguage::from_attribute("en-US", &user_prefers).unwrap(),
+            SystemLanguage(true)
         );
 
         assert_eq!(
-            SystemLanguage::from_attribute("en-GB", &user_prefers),
-            Ok(SystemLanguage(false))
+            SystemLanguage::from_attribute("en-GB", &user_prefers).unwrap(),
+            SystemLanguage(false)
         );
 
         assert_eq!(
-            SystemLanguage::from_attribute("DE", &user_prefers),
-            Ok(SystemLanguage(true))
+            SystemLanguage::from_attribute("DE", &user_prefers).unwrap(),
+            SystemLanguage(true)
         );
 
         assert_eq!(
-            SystemLanguage::from_attribute("de-LU", &user_prefers),
-            Ok(SystemLanguage(true))
+            SystemLanguage::from_attribute("de-LU", &user_prefers).unwrap(),
+            SystemLanguage(true)
         );
 
         assert_eq!(
-            SystemLanguage::from_attribute("fr, de", &user_prefers),
-            Ok(SystemLanguage(true))
+            SystemLanguage::from_attribute("fr, de", &user_prefers).unwrap(),
+            SystemLanguage(true)
         );
     }
 }
diff --git a/src/coord_units.rs b/src/coord_units.rs
index 20925ef9..b7d1a1c8 100644
--- a/src/coord_units.rs
+++ b/src/coord_units.rs
@@ -75,12 +75,12 @@ mod tests {
     #[test]
     fn parses_paint_server_units() {
         assert_eq!(
-            MyUnits::parse_str("userSpaceOnUse"),
-            Ok(MyUnits(CoordUnits::UserSpaceOnUse))
+            MyUnits::parse_str("userSpaceOnUse").unwrap(),
+            MyUnits(CoordUnits::UserSpaceOnUse)
         );
         assert_eq!(
-            MyUnits::parse_str("objectBoundingBox"),
-            Ok(MyUnits(CoordUnits::ObjectBoundingBox))
+            MyUnits::parse_str("objectBoundingBox").unwrap(),
+            MyUnits(CoordUnits::ObjectBoundingBox)
         );
     }
 
diff --git a/src/error.rs b/src/error.rs
index 566c44e5..6fe6d35b 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -22,7 +22,7 @@ use crate::url_resolver::Fragment;
 pub type ParseError<'i> = cssparser::ParseError<'i, ValueErrorKind>;
 
 /// A simple error which refers to an attribute's value
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone)]
 pub enum ValueErrorKind {
     /// A property with the specified name was not found
     UnknownProperty,
@@ -73,7 +73,7 @@ impl<'a> From<BasicParseError<'a>> for ValueErrorKind {
 }
 
 /// A complete error for an attribute and its erroneous value
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone)]
 pub struct ElementError {
     pub attr: QualName,
     pub err: ValueErrorKind,
diff --git a/src/filter.rs b/src/filter.rs
index 4cbbe819..dc589d33 100644
--- a/src/filter.rs
+++ b/src/filter.rs
@@ -242,11 +242,8 @@ mod tests {
         let f1 = Fragment::new(Some("foo.svg".to_string()), "bar".to_string());
         let f2 = Fragment::new(Some("test.svg".to_string()), "baz".to_string());
         assert_eq!(
-            FilterValueList::parse_str("url(foo.svg#bar) url(test.svg#baz)"),
-            Ok(FilterValueList(vec![
-                FilterValue::URL(f1),
-                FilterValue::URL(f2)
-            ]))
+            FilterValueList::parse_str("url(foo.svg#bar) url(test.svg#baz)").unwrap(),
+            FilterValueList(vec![FilterValue::URL(f1), FilterValue::URL(f2)])
         );
     }
 
diff --git a/src/font_props.rs b/src/font_props.rs
index 0051224f..fe47861d 100644
--- a/src/font_props.rs
+++ b/src/font_props.rs
@@ -586,16 +586,16 @@ mod tests {
     #[test]
     fn parses_font_weight() {
         assert_eq!(
-            <FontWeight as Parse>::parse_str("normal"),
-            Ok(FontWeight::Normal)
+            <FontWeight as Parse>::parse_str("normal").unwrap(),
+            FontWeight::Normal
         );
         assert_eq!(
-            <FontWeight as Parse>::parse_str("bold"),
-            Ok(FontWeight::Bold)
+            <FontWeight as Parse>::parse_str("bold").unwrap(),
+            FontWeight::Bold
         );
         assert_eq!(
-            <FontWeight as Parse>::parse_str("100"),
-            Ok(FontWeight::Weight(100))
+            <FontWeight as Parse>::parse_str("100").unwrap(),
+            FontWeight::Weight(100)
         );
     }
 
@@ -612,33 +612,28 @@ mod tests {
     #[test]
     fn parses_letter_spacing() {
         assert_eq!(
-            <LetterSpacing as Parse>::parse_str("normal"),
-            Ok(LetterSpacing::Normal)
+            <LetterSpacing as Parse>::parse_str("normal").unwrap(),
+            LetterSpacing::Normal
         );
         assert_eq!(
-            <LetterSpacing as Parse>::parse_str("10em"),
-            Ok(LetterSpacing::Value(Length::<Horizontal>::new(
-                10.0,
-                LengthUnit::Em,
-            )))
+            <LetterSpacing as Parse>::parse_str("10em").unwrap(),
+            LetterSpacing::Value(Length::<Horizontal>::new(10.0, LengthUnit::Em,))
         );
     }
 
     #[test]
     fn computes_letter_spacing() {
         assert_eq!(
-            <LetterSpacing as Parse>::parse_str("normal").map(|s| s.compute()),
-            Ok(LetterSpacing::Value(Length::<Horizontal>::new(
-                0.0,
-                LengthUnit::Px,
-            )))
+            <LetterSpacing as Parse>::parse_str("normal")
+                .map(|s| s.compute())
+                .unwrap(),
+            LetterSpacing::Value(Length::<Horizontal>::new(0.0, LengthUnit::Px,))
         );
         assert_eq!(
-            <LetterSpacing as Parse>::parse_str("10em").map(|s| s.compute()),
-            Ok(LetterSpacing::Value(Length::<Horizontal>::new(
-                10.0,
-                LengthUnit::Em,
-            )))
+            <LetterSpacing as Parse>::parse_str("10em")
+                .map(|s| s.compute())
+                .unwrap(),
+            LetterSpacing::Value(Length::<Horizontal>::new(10.0, LengthUnit::Em,))
         );
     }
 
@@ -650,38 +645,37 @@ mod tests {
     #[test]
     fn parses_font_family() {
         assert_eq!(
-            <FontFamily as Parse>::parse_str("'Hello world'"),
-            Ok(FontFamily("Hello world".to_owned()))
+            <FontFamily as Parse>::parse_str("'Hello world'").unwrap(),
+            FontFamily("Hello world".to_owned())
         );
 
         assert_eq!(
-            <FontFamily as Parse>::parse_str("\"Hello world\""),
-            Ok(FontFamily("Hello world".to_owned()))
+            <FontFamily as Parse>::parse_str("\"Hello world\"").unwrap(),
+            FontFamily("Hello world".to_owned())
         );
 
         assert_eq!(
-            <FontFamily as Parse>::parse_str("\"Hello world  with  spaces\""),
-            Ok(FontFamily("Hello world  with  spaces".to_owned()))
+            <FontFamily as Parse>::parse_str("\"Hello world  with  spaces\"").unwrap(),
+            FontFamily("Hello world  with  spaces".to_owned())
         );
 
         assert_eq!(
-            <FontFamily as Parse>::parse_str("  Hello  world  "),
-            Ok(FontFamily("Hello world".to_owned()))
+            <FontFamily as Parse>::parse_str("  Hello  world  ").unwrap(),
+            FontFamily("Hello world".to_owned())
         );
 
         assert_eq!(
-            <FontFamily as Parse>::parse_str("Plonk"),
-            Ok(FontFamily("Plonk".to_owned()))
+            <FontFamily as Parse>::parse_str("Plonk").unwrap(),
+            FontFamily("Plonk".to_owned())
         );
     }
 
     #[test]
     fn parses_multiple_font_family() {
         assert_eq!(
-            <FontFamily as Parse>::parse_str("serif,monospace,\"Hello world\", with  spaces "),
-            Ok(FontFamily(
-                "serif,monospace,Hello world,with spaces".to_owned()
-            ))
+            <FontFamily as Parse>::parse_str("serif,monospace,\"Hello world\", with  spaces ")
+                .unwrap(),
+            FontFamily("serif,monospace,Hello world,with spaces".to_owned())
         );
     }
 
@@ -695,23 +689,23 @@ mod tests {
     #[test]
     fn parses_line_height() {
         assert_eq!(
-            <LineHeight as Parse>::parse_str("normal"),
-            Ok(LineHeight::Normal),
+            <LineHeight as Parse>::parse_str("normal").unwrap(),
+            LineHeight::Normal
         );
 
         assert_eq!(
-            <LineHeight as Parse>::parse_str("2"),
-            Ok(LineHeight::Number(2.0)),
+            <LineHeight as Parse>::parse_str("2").unwrap(),
+            LineHeight::Number(2.0)
         );
 
         assert_eq!(
-            <LineHeight as Parse>::parse_str("2cm"),
-            Ok(LineHeight::Length(Length::new(2.0, LengthUnit::Cm))),
+            <LineHeight as Parse>::parse_str("2cm").unwrap(),
+            LineHeight::Length(Length::new(2.0, LengthUnit::Cm))
         );
 
         assert_eq!(
-            <LineHeight as Parse>::parse_str("150%"),
-            Ok(LineHeight::Percentage(1.5)),
+            <LineHeight as Parse>::parse_str("150%").unwrap(),
+            LineHeight::Percentage(1.5)
         );
     }
 
diff --git a/src/gradient.rs b/src/gradient.rs
index 1d9eb7d3..854b94cd 100644
--- a/src/gradient.rs
+++ b/src/gradient.rs
@@ -755,12 +755,15 @@ mod tests {
 
     #[test]
     fn parses_spread_method() {
-        assert_eq!(SpreadMethod::parse_str("pad"), Ok(SpreadMethod::Pad));
+        assert_eq!(SpreadMethod::parse_str("pad").unwrap(), SpreadMethod::Pad);
         assert_eq!(
-            SpreadMethod::parse_str("reflect"),
-            Ok(SpreadMethod::Reflect)
+            SpreadMethod::parse_str("reflect").unwrap(),
+            SpreadMethod::Reflect
+        );
+        assert_eq!(
+            SpreadMethod::parse_str("repeat").unwrap(),
+            SpreadMethod::Repeat
         );
-        assert_eq!(SpreadMethod::parse_str("repeat"), Ok(SpreadMethod::Repeat));
         assert!(SpreadMethod::parse_str("foobar").is_err());
     }
 
diff --git a/src/iri.rs b/src/iri.rs
index 1ce0db80..45d4dbd4 100644
--- a/src/iri.rs
+++ b/src/iri.rs
@@ -65,35 +65,29 @@ mod tests {
 
     #[test]
     fn parses_none() {
-        assert_eq!(IRI::parse_str("none"), Ok(IRI::None));
+        assert_eq!(IRI::parse_str("none").unwrap(), IRI::None);
     }
 
     #[test]
     fn parses_url() {
         assert_eq!(
-            IRI::parse_str("url(#bar)"),
-            Ok(IRI::Resource(Fragment::new(None, "bar".to_string())))
+            IRI::parse_str("url(#bar)").unwrap(),
+            IRI::Resource(Fragment::new(None, "bar".to_string()))
         );
 
         assert_eq!(
-            IRI::parse_str("url(foo#bar)"),
-            Ok(IRI::Resource(Fragment::new(
-                Some("foo".to_string()),
-                "bar".to_string()
-            )))
+            IRI::parse_str("url(foo#bar)").unwrap(),
+            IRI::Resource(Fragment::new(Some("foo".to_string()), "bar".to_string()))
         );
 
         // be permissive if the closing ) is missing
         assert_eq!(
-            IRI::parse_str("url(#bar"),
-            Ok(IRI::Resource(Fragment::new(None, "bar".to_string())))
+            IRI::parse_str("url(#bar").unwrap(),
+            IRI::Resource(Fragment::new(None, "bar".to_string()))
         );
         assert_eq!(
-            IRI::parse_str("url(foo#bar"),
-            Ok(IRI::Resource(Fragment::new(
-                Some("foo".to_string()),
-                "bar".to_string()
-            )))
+            IRI::parse_str("url(foo#bar").unwrap(),
+            IRI::Resource(Fragment::new(Some("foo".to_string()), "bar".to_string()))
         );
 
         assert!(IRI::parse_str("").is_err());
diff --git a/src/length.rs b/src/length.rs
index f9b59d15..f4503a8d 100644
--- a/src/length.rs
+++ b/src/length.rs
@@ -407,65 +407,65 @@ mod tests {
     #[test]
     fn parses_default() {
         assert_eq!(
-            Length::<Horizontal>::parse_str("42"),
-            Ok(Length::<Horizontal>::new(42.0, LengthUnit::Px))
+            Length::<Horizontal>::parse_str("42").unwrap(),
+            Length::<Horizontal>::new(42.0, LengthUnit::Px)
         );
 
         assert_eq!(
-            Length::<Horizontal>::parse_str("-42px"),
-            Ok(Length::<Horizontal>::new(-42.0, LengthUnit::Px))
+            Length::<Horizontal>::parse_str("-42px").unwrap(),
+            Length::<Horizontal>::new(-42.0, LengthUnit::Px)
         );
     }
 
     #[test]
     fn parses_percent() {
         assert_eq!(
-            Length::<Horizontal>::parse_str("50.0%"),
-            Ok(Length::<Horizontal>::new(0.5, LengthUnit::Percent))
+            Length::<Horizontal>::parse_str("50.0%").unwrap(),
+            Length::<Horizontal>::new(0.5, LengthUnit::Percent)
         );
     }
 
     #[test]
     fn parses_font_em() {
         assert_eq!(
-            Length::<Vertical>::parse_str("22.5em"),
-            Ok(Length::<Vertical>::new(22.5, LengthUnit::Em))
+            Length::<Vertical>::parse_str("22.5em").unwrap(),
+            Length::<Vertical>::new(22.5, LengthUnit::Em)
         );
     }
 
     #[test]
     fn parses_font_ex() {
         assert_eq!(
-            Length::<Vertical>::parse_str("22.5ex"),
-            Ok(Length::<Vertical>::new(22.5, LengthUnit::Ex))
+            Length::<Vertical>::parse_str("22.5ex").unwrap(),
+            Length::<Vertical>::new(22.5, LengthUnit::Ex)
         );
     }
 
     #[test]
     fn parses_physical_units() {
         assert_eq!(
-            Length::<Both>::parse_str("72pt"),
-            Ok(Length::<Both>::new(72.0, LengthUnit::Pt))
+            Length::<Both>::parse_str("72pt").unwrap(),
+            Length::<Both>::new(72.0, LengthUnit::Pt)
         );
 
         assert_eq!(
-            Length::<Both>::parse_str("-22.5in"),
-            Ok(Length::<Both>::new(-22.5, LengthUnit::In))
+            Length::<Both>::parse_str("-22.5in").unwrap(),
+            Length::<Both>::new(-22.5, LengthUnit::In)
         );
 
         assert_eq!(
-            Length::<Both>::parse_str("-254cm"),
-            Ok(Length::<Both>::new(-254.0, LengthUnit::Cm))
+            Length::<Both>::parse_str("-254cm").unwrap(),
+            Length::<Both>::new(-254.0, LengthUnit::Cm)
         );
 
         assert_eq!(
-            Length::<Both>::parse_str("254mm"),
-            Ok(Length::<Both>::new(254.0, LengthUnit::Mm))
+            Length::<Both>::parse_str("254mm").unwrap(),
+            Length::<Both>::new(254.0, LengthUnit::Mm)
         );
 
         assert_eq!(
-            Length::<Both>::parse_str("60pc"),
-            Ok(Length::<Both>::new(60.0, LengthUnit::Pc))
+            Length::<Both>::parse_str("60pc").unwrap(),
+            Length::<Both>::new(60.0, LengthUnit::Pc)
         );
     }
 
diff --git a/src/marker.rs b/src/marker.rs
index 228ec241..45fb9e94 100644
--- a/src/marker.rs
+++ b/src/marker.rs
@@ -812,12 +812,12 @@ mod parser_tests {
     #[test]
     fn parses_marker_units() {
         assert_eq!(
-            MarkerUnits::parse_str("userSpaceOnUse"),
-            Ok(MarkerUnits::UserSpaceOnUse)
+            MarkerUnits::parse_str("userSpaceOnUse").unwrap(),
+            MarkerUnits::UserSpaceOnUse
         );
         assert_eq!(
-            MarkerUnits::parse_str("strokeWidth"),
-            Ok(MarkerUnits::StrokeWidth)
+            MarkerUnits::parse_str("strokeWidth").unwrap(),
+            MarkerUnits::StrokeWidth
         );
     }
 
@@ -830,27 +830,27 @@ mod parser_tests {
 
     #[test]
     fn parses_marker_orient() {
-        assert_eq!(MarkerOrient::parse_str("auto"), Ok(MarkerOrient::Auto));
+        assert_eq!(MarkerOrient::parse_str("auto").unwrap(), MarkerOrient::Auto);
 
         assert_eq!(
-            MarkerOrient::parse_str("0"),
-            Ok(MarkerOrient::Angle(Angle::new(0.0)))
+            MarkerOrient::parse_str("0").unwrap(),
+            MarkerOrient::Angle(Angle::new(0.0))
         );
         assert_eq!(
-            MarkerOrient::parse_str("180"),
-            Ok(MarkerOrient::Angle(Angle::from_degrees(180.0)))
+            MarkerOrient::parse_str("180").unwrap(),
+            MarkerOrient::Angle(Angle::from_degrees(180.0))
         );
         assert_eq!(
-            MarkerOrient::parse_str("180deg"),
-            Ok(MarkerOrient::Angle(Angle::from_degrees(180.0)))
+            MarkerOrient::parse_str("180deg").unwrap(),
+            MarkerOrient::Angle(Angle::from_degrees(180.0))
         );
         assert_eq!(
-            MarkerOrient::parse_str("-400grad"),
-            Ok(MarkerOrient::Angle(Angle::from_degrees(-360.0)))
+            MarkerOrient::parse_str("-400grad").unwrap(),
+            MarkerOrient::Angle(Angle::from_degrees(-360.0))
         );
         assert_eq!(
-            MarkerOrient::parse_str("1rad"),
-            Ok(MarkerOrient::Angle(Angle::new(1.0)))
+            MarkerOrient::parse_str("1rad").unwrap(),
+            MarkerOrient::Angle(Angle::new(1.0))
         );
     }
 }
diff --git a/src/number_list.rs b/src/number_list.rs
index a7841c72..bb142072 100644
--- a/src/number_list.rs
+++ b/src/number_list.rs
@@ -74,23 +74,23 @@ mod tests {
     #[test]
     fn parses_number_list() {
         assert_eq!(
-            NumberList::parse_str("5", NumberListLength::Exact(1)),
-            Ok(NumberList(vec![5.0]))
+            NumberList::parse_str("5", NumberListLength::Exact(1)).unwrap(),
+            NumberList(vec![5.0])
         );
 
         assert_eq!(
-            NumberList::parse_str("1 2 3 4", NumberListLength::Exact(4)),
-            Ok(NumberList(vec![1.0, 2.0, 3.0, 4.0]))
+            NumberList::parse_str("1 2 3 4", NumberListLength::Exact(4)).unwrap(),
+            NumberList(vec![1.0, 2.0, 3.0, 4.0])
         );
 
         assert_eq!(
-            NumberList::parse_str("", NumberListLength::Unbounded),
-            Ok(NumberList(vec![]))
+            NumberList::parse_str("", NumberListLength::Unbounded).unwrap(),
+            NumberList(vec![])
         );
 
         assert_eq!(
-            NumberList::parse_str("1, 2, 3.0, 4, 5", NumberListLength::Unbounded),
-            Ok(NumberList(vec![1.0, 2.0, 3.0, 4.0, 5.0]))
+            NumberList::parse_str("1, 2, 3.0, 4, 5", NumberListLength::Unbounded).unwrap(),
+            NumberList(vec![1.0, 2.0, 3.0, 4.0, 5.0])
         );
     }
 
diff --git a/src/paint_server.rs b/src/paint_server.rs
index 017dfd2b..73e9287d 100644
--- a/src/paint_server.rs
+++ b/src/paint_server.rs
@@ -179,68 +179,68 @@ mod tests {
 
     #[test]
     fn parses_none() {
-        assert_eq!(PaintServer::parse_str("none"), Ok(PaintServer::None));
+        assert_eq!(PaintServer::parse_str("none").unwrap(), PaintServer::None);
     }
 
     #[test]
     fn parses_solid_color() {
         assert_eq!(
-            PaintServer::parse_str("rgb(255, 128, 64, 0.5)"),
-            Ok(PaintServer::SolidColor(cssparser::Color::RGBA(
-                cssparser::RGBA::new(255, 128, 64, 128)
+            PaintServer::parse_str("rgb(255, 128, 64, 0.5)").unwrap(),
+            PaintServer::SolidColor(cssparser::Color::RGBA(cssparser::RGBA::new(
+                255, 128, 64, 128
             )))
         );
 
         assert_eq!(
-            PaintServer::parse_str("currentColor"),
-            Ok(PaintServer::SolidColor(cssparser::Color::CurrentColor))
+            PaintServer::parse_str("currentColor").unwrap(),
+            PaintServer::SolidColor(cssparser::Color::CurrentColor)
         );
     }
 
     #[test]
     fn parses_iri() {
         assert_eq!(
-            PaintServer::parse_str("url(#link)"),
-            Ok(PaintServer::Iri {
+            PaintServer::parse_str("url(#link)").unwrap(),
+            PaintServer::Iri {
                 iri: Fragment::new(None, "link".to_string()),
                 alternate: None,
-            },)
+            }
         );
 
         assert_eq!(
-            PaintServer::parse_str("url(foo#link) none"),
-            Ok(PaintServer::Iri {
+            PaintServer::parse_str("url(foo#link) none").unwrap(),
+            PaintServer::Iri {
                 iri: Fragment::new(Some("foo".to_string()), "link".to_string()),
                 alternate: None,
-            },)
+            }
         );
 
         assert_eq!(
-            PaintServer::parse_str("url(#link) #ff8040"),
-            Ok(PaintServer::Iri {
+            PaintServer::parse_str("url(#link) #ff8040").unwrap(),
+            PaintServer::Iri {
                 iri: Fragment::new(None, "link".to_string()),
                 alternate: Some(cssparser::Color::RGBA(cssparser::RGBA::new(
                     255, 128, 64, 255
                 ))),
-            },)
+            }
         );
 
         assert_eq!(
-            PaintServer::parse_str("url(#link) rgb(255, 128, 64, 0.5)"),
-            Ok(PaintServer::Iri {
+            PaintServer::parse_str("url(#link) rgb(255, 128, 64, 0.5)").unwrap(),
+            PaintServer::Iri {
                 iri: Fragment::new(None, "link".to_string()),
                 alternate: Some(cssparser::Color::RGBA(cssparser::RGBA::new(
                     255, 128, 64, 128
                 ))),
-            },)
+            }
         );
 
         assert_eq!(
-            PaintServer::parse_str("url(#link) currentColor"),
-            Ok(PaintServer::Iri {
+            PaintServer::parse_str("url(#link) currentColor").unwrap(),
+            PaintServer::Iri {
                 iri: Fragment::new(None, "link".to_string()),
                 alternate: Some(cssparser::Color::CurrentColor),
-            },)
+            }
         );
 
         assert!(PaintServer::parse_str("url(#link) invalid").is_err());
diff --git a/src/parsers.rs b/src/parsers.rs
index c43cc1d4..14d558ac 100644
--- a/src/parsers.rs
+++ b/src/parsers.rs
@@ -188,29 +188,29 @@ mod tests {
     #[test]
     fn parses_number_optional_number() {
         assert_eq!(
-            NumberOptionalNumber::parse_str("1, 2"),
-            Ok(NumberOptionalNumber(1.0, 2.0))
+            NumberOptionalNumber::parse_str("1, 2").unwrap(),
+            NumberOptionalNumber(1.0, 2.0)
         );
         assert_eq!(
-            NumberOptionalNumber::parse_str("1 2"),
-            Ok(NumberOptionalNumber(1.0, 2.0))
+            NumberOptionalNumber::parse_str("1 2").unwrap(),
+            NumberOptionalNumber(1.0, 2.0)
         );
         assert_eq!(
-            NumberOptionalNumber::parse_str("1"),
-            Ok(NumberOptionalNumber(1.0, 1.0))
+            NumberOptionalNumber::parse_str("1").unwrap(),
+            NumberOptionalNumber(1.0, 1.0)
         );
 
         assert_eq!(
-            NumberOptionalNumber::parse_str("-1, -2"),
-            Ok(NumberOptionalNumber(-1.0, -2.0))
+            NumberOptionalNumber::parse_str("-1, -2").unwrap(),
+            NumberOptionalNumber(-1.0, -2.0)
         );
         assert_eq!(
-            NumberOptionalNumber::parse_str("-1 -2"),
-            Ok(NumberOptionalNumber(-1.0, -2.0))
+            NumberOptionalNumber::parse_str("-1 -2").unwrap(),
+            NumberOptionalNumber(-1.0, -2.0)
         );
         assert_eq!(
-            NumberOptionalNumber::parse_str("-1"),
-            Ok(NumberOptionalNumber(-1.0, -1.0))
+            NumberOptionalNumber::parse_str("-1").unwrap(),
+            NumberOptionalNumber(-1.0, -1.0)
         );
     }
 
@@ -227,8 +227,8 @@ mod tests {
 
     #[test]
     fn parses_integer() {
-        assert_eq!(i32::parse_str("1"), Ok(1));
-        assert_eq!(i32::parse_str("-1"), Ok(-1));
+        assert_eq!(i32::parse_str("1").unwrap(), 1);
+        assert_eq!(i32::parse_str("-1").unwrap(), -1);
     }
 
     #[test]
@@ -241,29 +241,29 @@ mod tests {
     #[test]
     fn parses_integer_optional_integer() {
         assert_eq!(
-            NumberOptionalNumber::parse_str("1, 2"),
-            Ok(NumberOptionalNumber(1, 2))
+            NumberOptionalNumber::parse_str("1, 2").unwrap(),
+            NumberOptionalNumber(1, 2)
         );
         assert_eq!(
-            NumberOptionalNumber::parse_str("1 2"),
-            Ok(NumberOptionalNumber(1, 2))
+            NumberOptionalNumber::parse_str("1 2").unwrap(),
+            NumberOptionalNumber(1, 2)
         );
         assert_eq!(
-            NumberOptionalNumber::parse_str("1"),
-            Ok(NumberOptionalNumber(1, 1))
+            NumberOptionalNumber::parse_str("1").unwrap(),
+            NumberOptionalNumber(1, 1)
         );
 
         assert_eq!(
-            NumberOptionalNumber::parse_str("-1, -2"),
-            Ok(NumberOptionalNumber(-1, -2))
+            NumberOptionalNumber::parse_str("-1, -2").unwrap(),
+            NumberOptionalNumber(-1, -2)
         );
         assert_eq!(
-            NumberOptionalNumber::parse_str("-1 -2"),
-            Ok(NumberOptionalNumber(-1, -2))
+            NumberOptionalNumber::parse_str("-1 -2").unwrap(),
+            NumberOptionalNumber(-1, -2)
         );
         assert_eq!(
-            NumberOptionalNumber::parse_str("-1"),
-            Ok(NumberOptionalNumber(-1, -1))
+            NumberOptionalNumber::parse_str("-1").unwrap(),
+            NumberOptionalNumber(-1, -1)
         );
     }
 
@@ -284,8 +284,8 @@ mod tests {
     #[test]
     fn parses_custom_ident() {
         assert_eq!(
-            CustomIdent::parse_str("hello"),
-            Ok(CustomIdent("hello".to_string()))
+            CustomIdent::parse_str("hello").unwrap(),
+            CustomIdent("hello".to_string())
         );
     }
 
diff --git a/src/property_macros.rs b/src/property_macros.rs
index 5ad4185d..a1b8fb4a 100644
--- a/src/property_macros.rs
+++ b/src/property_macros.rs
@@ -281,6 +281,6 @@ mod tests {
         assert_eq!(<Foo as Default>::default(), Foo::Def);
         assert_eq!(<Foo as Property<()>>::inherits_automatically(), true);
         assert!(<Foo as Parse>::parse_str("blargh").is_err());
-        assert_eq!(<Foo as Parse>::parse_str("bar"), Ok(Foo::Bar));
+        assert_eq!(<Foo as Parse>::parse_str("bar").unwrap(), Foo::Bar);
     }
 }
diff --git a/src/shapes.rs b/src/shapes.rs
index 69b5f762..1fd72368 100644
--- a/src/shapes.rs
+++ b/src/shapes.rs
@@ -605,26 +605,29 @@ mod tests {
 
     #[test]
     fn parses_points() {
-        assert_eq!(Points::parse_str(" 1 2 "), Ok(Points(vec![(1.0, 2.0)])));
         assert_eq!(
-            Points::parse_str("1 2 3 4"),
-            Ok(Points(vec![(1.0, 2.0), (3.0, 4.0)]))
+            Points::parse_str(" 1 2 ").unwrap(),
+            Points(vec![(1.0, 2.0)])
         );
         assert_eq!(
-            Points::parse_str("1,2,3,4"),
-            Ok(Points(vec![(1.0, 2.0), (3.0, 4.0)]))
+            Points::parse_str("1 2 3 4").unwrap(),
+            Points(vec![(1.0, 2.0), (3.0, 4.0)])
         );
         assert_eq!(
-            Points::parse_str("1,2 3,4"),
-            Ok(Points(vec![(1.0, 2.0), (3.0, 4.0)]))
+            Points::parse_str("1,2,3,4").unwrap(),
+            Points(vec![(1.0, 2.0), (3.0, 4.0)])
         );
         assert_eq!(
-            Points::parse_str("1,2 -3,4"),
-            Ok(Points(vec![(1.0, 2.0), (-3.0, 4.0)]))
+            Points::parse_str("1,2 3,4").unwrap(),
+            Points(vec![(1.0, 2.0), (3.0, 4.0)])
         );
         assert_eq!(
-            Points::parse_str("1,2,-3,4"),
-            Ok(Points(vec![(1.0, 2.0), (-3.0, 4.0)]))
+            Points::parse_str("1,2 -3,4").unwrap(),
+            Points(vec![(1.0, 2.0), (-3.0, 4.0)])
+        );
+        assert_eq!(
+            Points::parse_str("1,2,-3,4").unwrap(),
+            Points(vec![(1.0, 2.0), (-3.0, 4.0)])
         );
     }
 
diff --git a/src/style.rs b/src/style.rs
index c00a97c6..c38e79d7 100644
--- a/src/style.rs
+++ b/src/style.rs
@@ -70,7 +70,7 @@ mod tests {
 
     #[test]
     fn parses_style_type() {
-        assert_eq!(StyleType::parse("text/css"), Ok(StyleType::TextCss));
+        assert_eq!(StyleType::parse("text/css").unwrap(), StyleType::TextCss);
     }
 
     #[test]
diff --git a/src/unit_interval.rs b/src/unit_interval.rs
index 646e84c1..2794f8e5 100644
--- a/src/unit_interval.rs
+++ b/src/unit_interval.rs
@@ -44,15 +44,15 @@ mod tests {
 
     #[test]
     fn parses_number() {
-        assert_eq!(UnitInterval::parse_str("0"), Ok(UnitInterval(0.0)));
-        assert_eq!(UnitInterval::parse_str("1"), Ok(UnitInterval(1.0)));
-        assert_eq!(UnitInterval::parse_str("0.5"), Ok(UnitInterval(0.5)));
+        assert_eq!(UnitInterval::parse_str("0").unwrap(), UnitInterval(0.0));
+        assert_eq!(UnitInterval::parse_str("1").unwrap(), UnitInterval(1.0));
+        assert_eq!(UnitInterval::parse_str("0.5").unwrap(), UnitInterval(0.5));
     }
 
     #[test]
     fn parses_out_of_range_number() {
-        assert_eq!(UnitInterval::parse_str("-10"), Ok(UnitInterval(0.0)));
-        assert_eq!(UnitInterval::parse_str("10"), Ok(UnitInterval(1.0)));
+        assert_eq!(UnitInterval::parse_str("-10").unwrap(), UnitInterval(0.0));
+        assert_eq!(UnitInterval::parse_str("10").unwrap(), UnitInterval(1.0));
     }
 
     #[test]
diff --git a/src/viewbox.rs b/src/viewbox.rs
index fbd2d28e..5c4691e2 100644
--- a/src/viewbox.rs
+++ b/src/viewbox.rs
@@ -67,13 +67,13 @@ mod tests {
     #[test]
     fn parses_valid_viewboxes() {
         assert_eq!(
-            ViewBox::parse_str("  1 2 3 4"),
-            Ok(ViewBox(Rect::new(1.0, 2.0, 4.0, 6.0)))
+            ViewBox::parse_str("  1 2 3 4").unwrap(),
+            ViewBox(Rect::new(1.0, 2.0, 4.0, 6.0))
         );
 
         assert_eq!(
-            ViewBox::parse_str(" -1.5 -2.5e1,34,56e2  "),
-            Ok(ViewBox(Rect::new(-1.5, -25.0, 32.5, 5575.0)))
+            ViewBox::parse_str(" -1.5 -2.5e1,34,56e2  ").unwrap(),
+            ViewBox(Rect::new(-1.5, -25.0, 32.5, 5575.0))
         );
     }
 



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