[librsvg: 8/9] Rustfmt: Switch 'indent_style' to 'Block'.



commit 7c5ecc401d03937ddec7feecd6d8ca645baf58be
Author: Jordan Petridis <jordanpetridis protonmail com>
Date:   Thu Mar 1 14:01:40 2018 +0200

    Rustfmt: Switch 'indent_style' to 'Block'.
    
    Temporarly switch to sidestep https://github.com/rust-lang-nursery/rustfmt/issues/2496
    so people can start using rustfmt and the CI test succed.

 .rustfmt.toml                      |    3 +-
 rsvg_internals/build.rs            |    5 +-
 rsvg_internals/src/aspect_ratio.rs |  520 ++++++++-----
 rsvg_internals/src/attributes.rs   |   19 +-
 rsvg_internals/src/bbox.rs         |   16 +-
 rsvg_internals/src/clip_path.rs    |   23 +-
 rsvg_internals/src/cnode.rs        |   88 ++-
 rsvg_internals/src/color.rs        |  252 ++++---
 rsvg_internals/src/coord_units.rs  |   23 +-
 rsvg_internals/src/drawing_ctx.rs  |  114 +--
 rsvg_internals/src/error.rs        |   34 +-
 rsvg_internals/src/gradient.rs     |  310 ++++----
 rsvg_internals/src/image.rs        |   77 +-
 rsvg_internals/src/length.rs       |  442 +++++++----
 rsvg_internals/src/link.rs         |   42 +-
 rsvg_internals/src/marker.rs       |  551 ++++++++------
 rsvg_internals/src/mask.rs         |   68 +-
 rsvg_internals/src/node.rs         |  203 ++---
 rsvg_internals/src/opacity.rs      |   92 ++-
 rsvg_internals/src/paint_server.rs |  231 +++---
 rsvg_internals/src/parsers.rs      |  112 +--
 rsvg_internals/src/path_builder.rs |   83 +-
 rsvg_internals/src/path_parser.rs  | 1460 +++++++++++++++++++++---------------
 rsvg_internals/src/pattern.rs      |  160 ++--
 rsvg_internals/src/property_bag.rs |   55 +-
 rsvg_internals/src/shapes.rs       |  291 ++++---
 rsvg_internals/src/space.rs        |  113 ++-
 rsvg_internals/src/state.rs        |    8 +-
 rsvg_internals/src/stop.rs         |   53 +-
 rsvg_internals/src/structure.rs    |  325 ++++----
 rsvg_internals/src/text.rs         |   25 +-
 rsvg_internals/src/transform.rs    |  313 ++++----
 rsvg_internals/src/viewbox.rs      |   70 +-
 rsvg_internals/src/viewport.rs     |  218 +++---
 34 files changed, 3846 insertions(+), 2553 deletions(-)
---
diff --git a/.rustfmt.toml b/.rustfmt.toml
index d3b593fb..74c46811 100644
--- a/.rustfmt.toml
+++ b/.rustfmt.toml
@@ -1,5 +1,5 @@
 unstable_features = true
-indent_style = "Visual"
+indent_style = "Block"
 verbose = false
 max_width = 100
 comment_width = 100
@@ -15,6 +15,5 @@ reorder_imports = true
 reorder_imported_names = true
 reorder_imports_in_group = true
 use_field_init_shorthand = true
-error_on_line_overflow = false
 imports_indent = "Block"
 imports_layout = "HorizontalVertical"
\ No newline at end of file
diff --git a/rsvg_internals/build.rs b/rsvg_internals/build.rs
index ac9069ed..4ce9beba 100644
--- a/rsvg_internals/build.rs
+++ b/rsvg_internals/build.rs
@@ -177,7 +177,10 @@ fn generate_phf_of_svg_attributes() {
 
     writeln!(&mut file, "}}").unwrap();
 
-    writeln!(&mut file, "static ATTRIBUTES: phf::Map<&'static str, Attribute> = ").unwrap();
+    writeln!(
+        &mut file,
+        "static ATTRIBUTES: phf::Map<&'static str, Attribute> = "
+    ).unwrap();
 
     let mut map = phf_codegen::Map::new();
     map.phf_path("phf");
diff --git a/rsvg_internals/src/aspect_ratio.rs b/rsvg_internals/src/aspect_ratio.rs
index ff5fb7a3..210441a7 100644
--- a/rsvg_internals/src/aspect_ratio.rs
+++ b/rsvg_internals/src/aspect_ratio.rs
@@ -4,10 +4,16 @@
 //! We have an [`AspectRatio`] struct which encapsulates such a value.
 //!
 //! ```
-//! assert_eq!(AspectRatio::parse("xMidYMid", ()),
-//!            Ok(AspectRatio { defer: false,
-//!                             align: Align::Aligned { align: AlignMode::XmidYmid,
-//!                                                     fit: FitMode::Meet, }, }));
+//! assert_eq!(
+//!     AspectRatio::parse("xMidYMid", ()),
+//!     Ok(AspectRatio {
+//!         defer: false,
+//!         align: Align::Aligned {
+//!             align: AlignMode::XmidYmid,
+//!             fit: FitMode::Meet,
+//!         },
+//!     })
+//! );
 //! ```
 //!
 //! [`AspectRatio`]: struct.AspectRatio.html
@@ -64,14 +70,15 @@ fn align_1d(a: Align1D, dest_pos: f64, dest_size: f64, obj_size: f64) -> f64 {
 }
 
 impl AspectRatio {
-    pub fn compute(&self,
-                   object_width: f64,
-                   object_height: f64,
-                   dest_x: f64,
-                   dest_y: f64,
-                   dest_width: f64,
-                   dest_height: f64)
-                   -> (f64, f64, f64, f64) {
+    pub fn compute(
+        &self,
+        object_width: f64,
+        object_height: f64,
+        dest_x: f64,
+        dest_y: f64,
+        dest_width: f64,
+        dest_height: f64,
+    ) -> (f64, f64, f64, f64) {
         match self.align {
             Align::None => (dest_x, dest_y, dest_width, dest_height),
 
@@ -145,39 +152,61 @@ impl AspectRatio {
 
 impl Default for Align {
     fn default() -> Align {
-        Align::Aligned { align: AlignMode::XmidYmid,
-                         fit: FitMode::Meet, }
+        Align::Aligned {
+            align: AlignMode::XmidYmid,
+            fit: FitMode::Meet,
+        }
     }
 }
 
 impl Default for AspectRatio {
     fn default() -> AspectRatio {
-        AspectRatio { defer: false,
-                      align: Default::default(), }
+        AspectRatio {
+            defer: false,
+            align: Default::default(),
+        }
     }
 }
 
 fn parse_align_mode(s: &str) -> Option<Align> {
     match s {
         "none" => Some(Align::None),
-        "xMinYMin" => Some(Align::Aligned { align: AlignMode::XminYmin,
-                                            fit: FitMode::Meet, }),
-        "xMidYMin" => Some(Align::Aligned { align: AlignMode::XmidYmin,
-                                            fit: FitMode::Meet, }),
-        "xMaxYMin" => Some(Align::Aligned { align: AlignMode::XmaxYmin,
-                                            fit: FitMode::Meet, }),
-        "xMinYMid" => Some(Align::Aligned { align: AlignMode::XminYmid,
-                                            fit: FitMode::Meet, }),
-        "xMidYMid" => Some(Align::Aligned { align: AlignMode::XmidYmid,
-                                            fit: FitMode::Meet, }),
-        "xMaxYMid" => Some(Align::Aligned { align: AlignMode::XmaxYmid,
-                                            fit: FitMode::Meet, }),
-        "xMinYMax" => Some(Align::Aligned { align: AlignMode::XminYmax,
-                                            fit: FitMode::Meet, }),
-        "xMidYMax" => Some(Align::Aligned { align: AlignMode::XmidYmax,
-                                            fit: FitMode::Meet, }),
-        "xMaxYMax" => Some(Align::Aligned { align: AlignMode::XmaxYmax,
-                                            fit: FitMode::Meet, }),
+        "xMinYMin" => Some(Align::Aligned {
+            align: AlignMode::XminYmin,
+            fit: FitMode::Meet,
+        }),
+        "xMidYMin" => Some(Align::Aligned {
+            align: AlignMode::XmidYmin,
+            fit: FitMode::Meet,
+        }),
+        "xMaxYMin" => Some(Align::Aligned {
+            align: AlignMode::XmaxYmin,
+            fit: FitMode::Meet,
+        }),
+        "xMinYMid" => Some(Align::Aligned {
+            align: AlignMode::XminYmid,
+            fit: FitMode::Meet,
+        }),
+        "xMidYMid" => Some(Align::Aligned {
+            align: AlignMode::XmidYmid,
+            fit: FitMode::Meet,
+        }),
+        "xMaxYMid" => Some(Align::Aligned {
+            align: AlignMode::XmaxYmid,
+            fit: FitMode::Meet,
+        }),
+        "xMinYMax" => Some(Align::Aligned {
+            align: AlignMode::XminYmax,
+            fit: FitMode::Meet,
+        }),
+        "xMidYMax" => Some(Align::Aligned {
+            align: AlignMode::XmidYmax,
+            fit: FitMode::Meet,
+        }),
+        "xMaxYMax" => Some(Align::Aligned {
+            align: AlignMode::XmaxYmax,
+            fit: FitMode::Meet,
+        }),
         _ => None,
     }
 }
@@ -198,7 +227,9 @@ enum ParseState {
 }
 
 fn make_err() -> AttributeError {
-    AttributeError::Parse(ParseError::new("expected \"[defer] <align> [meet | slice]\""))
+    AttributeError::Parse(ParseError::new(
+        "expected \"[defer] <align> [meet | slice]\"",
+    ))
 }
 
 impl Parse for AspectRatio {
@@ -260,12 +291,16 @@ impl Parse for AspectRatio {
             }
         }
 
-        Ok(AspectRatio { defer,
-                         align: match align {
-                             Align::None => Align::None,
-                             Align::Aligned { align, .. } => Align::Aligned { align,
-                                                                              fit: fit_mode, },
-                         }, })
+        Ok(AspectRatio {
+            defer,
+            align: match align {
+                Align::None => Align::None,
+                Align::Aligned { align, .. } => Align::Aligned {
+                    align,
+                    fit: fit_mode,
+                },
+            },
+        })
     }
 }
 
@@ -294,144 +329,277 @@ mod tests {
 
     #[test]
     fn parses_valid_strings() {
-        assert_eq!(AspectRatio::parse("defer none", ()),
-                   Ok(AspectRatio { defer: true,
-                                    align: Align::None, }));
-
-        assert_eq!(AspectRatio::parse("xMidYMid", ()),
-                   Ok(AspectRatio { defer: false,
-                                    align: Align::Aligned { align: AlignMode::XmidYmid,
-                                                            fit: FitMode::Meet, }, }));
-
-        assert_eq!(AspectRatio::parse("defer xMidYMid", ()),
-                   Ok(AspectRatio { defer: true,
-                                    align: Align::Aligned { align: AlignMode::XmidYmid,
-                                                            fit: FitMode::Meet, }, }));
-
-        assert_eq!(AspectRatio::parse("defer xMinYMax", ()),
-                   Ok(AspectRatio { defer: true,
-                                    align: Align::Aligned { align: AlignMode::XminYmax,
-                                                            fit: FitMode::Meet, }, }));
-
-        assert_eq!(AspectRatio::parse("defer xMaxYMid meet", ()),
-                   Ok(AspectRatio { defer: true,
-                                    align: Align::Aligned { align: AlignMode::XmaxYmid,
-                                                            fit: FitMode::Meet, }, }));
-
-        assert_eq!(AspectRatio::parse("defer xMinYMax slice", ()),
-                   Ok(AspectRatio { defer: true,
-                                    align: Align::Aligned { align: AlignMode::XminYmax,
-                                                            fit: FitMode::Slice, }, }));
+        assert_eq!(
+            AspectRatio::parse("defer none", ()),
+            Ok(AspectRatio {
+                defer: true,
+                align: Align::None,
+            })
+        );
+
+        assert_eq!(
+            AspectRatio::parse("xMidYMid", ()),
+            Ok(AspectRatio {
+                defer: false,
+                align: Align::Aligned {
+                    align: AlignMode::XmidYmid,
+                    fit: FitMode::Meet,
+                },
+            })
+        );
+
+        assert_eq!(
+            AspectRatio::parse("defer xMidYMid", ()),
+            Ok(AspectRatio {
+                defer: true,
+                align: Align::Aligned {
+                    align: AlignMode::XmidYmid,
+                    fit: FitMode::Meet,
+                },
+            })
+        );
+
+        assert_eq!(
+            AspectRatio::parse("defer xMinYMax", ()),
+            Ok(AspectRatio {
+                defer: true,
+                align: Align::Aligned {
+                    align: AlignMode::XminYmax,
+                    fit: FitMode::Meet,
+                },
+            })
+        );
+
+        assert_eq!(
+            AspectRatio::parse("defer xMaxYMid meet", ()),
+            Ok(AspectRatio {
+                defer: true,
+                align: Align::Aligned {
+                    align: AlignMode::XmaxYmid,
+                    fit: FitMode::Meet,
+                },
+            })
+        );
+
+        assert_eq!(
+            AspectRatio::parse("defer xMinYMax slice", ()),
+            Ok(AspectRatio {
+                defer: true,
+                align: Align::Aligned {
+                    align: AlignMode::XminYmax,
+                    fit: FitMode::Slice,
+                },
+            })
+        );
     }
 
     #[test]
     fn aligns() {
-        assert_eq!(AspectRatio::parse("xMinYMin meet", ()).unwrap()
-                                                          .compute(1.0, 10.0, 0.0, 0.0, 10.0, 1.0),
-                   (0.0, 0.0, 0.1, 1.0));
-        assert_eq!(AspectRatio::parse("xMinYMin slice", ()).unwrap()
-                                                           .compute(1.0,
-                                                                    10.0,
-                                                                    0.0,
-                                                                    0.0,
-                                                                    10.0,
-                                                                    1.0),
-                   (0.0, 0.0, 10.0, 100.0));
-
-        assert_eq!(AspectRatio::parse("xMinYMid meet", ()).unwrap()
-                                                          .compute(1.0, 10.0, 0.0, 0.0, 10.0, 1.0),
-                   (0.0, 0.0, 0.1, 1.0));
-        assert_eq!(AspectRatio::parse("xMinYMid slice", ()).unwrap()
-                                                           .compute(1.0,
-                                                                    10.0,
-                                                                    0.0,
-                                                                    0.0,
-                                                                    10.0,
-                                                                    1.0),
-                   (0.0, -49.5, 10.0, 100.0));
-
-        assert_eq!(AspectRatio::parse("xMinYMax meet", ()).unwrap()
-                                                          .compute(1.0, 10.0, 0.0, 0.0, 10.0, 1.0),
-                   (0.0, 0.0, 0.1, 1.0));
-        assert_eq!(AspectRatio::parse("xMinYMax slice", ()).unwrap()
-                                                           .compute(1.0,
-                                                                    10.0,
-                                                                    0.0,
-                                                                    0.0,
-                                                                    10.0,
-                                                                    1.0),
-                   (0.0, -99.0, 10.0, 100.0));
-
-        assert_eq!(AspectRatio::parse("xMidYMin meet", ()).unwrap()
-                                                          .compute(1.0, 10.0, 0.0, 0.0, 10.0, 1.0),
-                   (4.95, 0.0, 0.1, 1.0));
-        assert_eq!(AspectRatio::parse("xMidYMin slice", ()).unwrap()
-                                                           .compute(1.0,
-                                                                    10.0,
-                                                                    0.0,
-                                                                    0.0,
-                                                                    10.0,
-                                                                    1.0),
-                   (0.0, 0.0, 10.0, 100.0));
-
-        assert_eq!(AspectRatio::parse("xMidYMid meet", ()).unwrap()
-                                                          .compute(1.0, 10.0, 0.0, 0.0, 10.0, 1.0),
-                   (4.95, 0.0, 0.1, 1.0));
-        assert_eq!(AspectRatio::parse("xMidYMid slice", ()).unwrap()
-                                                           .compute(1.0,
-                                                                    10.0,
-                                                                    0.0,
-                                                                    0.0,
-                                                                    10.0,
-                                                                    1.0),
-                   (0.0, -49.5, 10.0, 100.0));
-
-        assert_eq!(AspectRatio::parse("xMidYMax meet", ()).unwrap()
-                                                          .compute(1.0, 10.0, 0.0, 0.0, 10.0, 1.0),
-                   (4.95, 0.0, 0.1, 1.0));
-        assert_eq!(AspectRatio::parse("xMidYMax slice", ()).unwrap()
-                                                           .compute(1.0,
-                                                                    10.0,
-                                                                    0.0,
-                                                                    0.0,
-                                                                    10.0,
-                                                                    1.0),
-                   (0.0, -99.0, 10.0, 100.0));
-
-        assert_eq!(AspectRatio::parse("xMaxYMin meet", ()).unwrap()
-                                                          .compute(1.0, 10.0, 0.0, 0.0, 10.0, 1.0),
-                   (9.9, 0.0, 0.1, 1.0));
-        assert_eq!(AspectRatio::parse("xMaxYMin slice", ()).unwrap()
-                                                           .compute(1.0,
-                                                                    10.0,
-                                                                    0.0,
-                                                                    0.0,
-                                                                    10.0,
-                                                                    1.0),
-                   (0.0, 0.0, 10.0, 100.0));
-
-        assert_eq!(AspectRatio::parse("xMaxYMid meet", ()).unwrap()
-                                                          .compute(1.0, 10.0, 0.0, 0.0, 10.0, 1.0),
-                   (9.9, 0.0, 0.1, 1.0));
-        assert_eq!(AspectRatio::parse("xMaxYMid slice", ()).unwrap()
-                                                           .compute(1.0,
-                                                                    10.0,
-                                                                    0.0,
-                                                                    0.0,
-                                                                    10.0,
-                                                                    1.0),
-                   (0.0, -49.5, 10.0, 100.0));
-
-        assert_eq!(AspectRatio::parse("xMaxYMax meet", ()).unwrap()
-                                                          .compute(1.0, 10.0, 0.0, 0.0, 10.0, 1.0),
-                   (9.9, 0.0, 0.1, 1.0));
-        assert_eq!(AspectRatio::parse("xMaxYMax slice", ()).unwrap()
-                                                           .compute(1.0,
-                                                                    10.0,
-                                                                    0.0,
-                                                                    0.0,
-                                                                    10.0,
-                                                                    1.0),
-                   (0.0, -99.0, 10.0, 100.0));
+        assert_eq!(
+            AspectRatio::parse("xMinYMin meet", ()).unwrap().compute(
+                1.0,
+                10.0,
+                0.0,
+                0.0,
+                10.0,
+                1.0
+            ),
+            (0.0, 0.0, 0.1, 1.0)
+        );
+        assert_eq!(
+            AspectRatio::parse("xMinYMin slice", ()).unwrap().compute(
+                1.0,
+                10.0,
+                0.0,
+                0.0,
+                10.0,
+                1.0
+            ),
+            (0.0, 0.0, 10.0, 100.0)
+        );
+
+        assert_eq!(
+            AspectRatio::parse("xMinYMid meet", ()).unwrap().compute(
+                1.0,
+                10.0,
+                0.0,
+                0.0,
+                10.0,
+                1.0
+            ),
+            (0.0, 0.0, 0.1, 1.0)
+        );
+        assert_eq!(
+            AspectRatio::parse("xMinYMid slice", ()).unwrap().compute(
+                1.0,
+                10.0,
+                0.0,
+                0.0,
+                10.0,
+                1.0
+            ),
+            (0.0, -49.5, 10.0, 100.0)
+        );
+
+        assert_eq!(
+            AspectRatio::parse("xMinYMax meet", ()).unwrap().compute(
+                1.0,
+                10.0,
+                0.0,
+                0.0,
+                10.0,
+                1.0
+            ),
+            (0.0, 0.0, 0.1, 1.0)
+        );
+        assert_eq!(
+            AspectRatio::parse("xMinYMax slice", ()).unwrap().compute(
+                1.0,
+                10.0,
+                0.0,
+                0.0,
+                10.0,
+                1.0
+            ),
+            (0.0, -99.0, 10.0, 100.0)
+        );
+
+        assert_eq!(
+            AspectRatio::parse("xMidYMin meet", ()).unwrap().compute(
+                1.0,
+                10.0,
+                0.0,
+                0.0,
+                10.0,
+                1.0
+            ),
+            (4.95, 0.0, 0.1, 1.0)
+        );
+        assert_eq!(
+            AspectRatio::parse("xMidYMin slice", ()).unwrap().compute(
+                1.0,
+                10.0,
+                0.0,
+                0.0,
+                10.0,
+                1.0
+            ),
+            (0.0, 0.0, 10.0, 100.0)
+        );
+
+        assert_eq!(
+            AspectRatio::parse("xMidYMid meet", ()).unwrap().compute(
+                1.0,
+                10.0,
+                0.0,
+                0.0,
+                10.0,
+                1.0
+            ),
+            (4.95, 0.0, 0.1, 1.0)
+        );
+        assert_eq!(
+            AspectRatio::parse("xMidYMid slice", ()).unwrap().compute(
+                1.0,
+                10.0,
+                0.0,
+                0.0,
+                10.0,
+                1.0
+            ),
+            (0.0, -49.5, 10.0, 100.0)
+        );
+
+        assert_eq!(
+            AspectRatio::parse("xMidYMax meet", ()).unwrap().compute(
+                1.0,
+                10.0,
+                0.0,
+                0.0,
+                10.0,
+                1.0
+            ),
+            (4.95, 0.0, 0.1, 1.0)
+        );
+        assert_eq!(
+            AspectRatio::parse("xMidYMax slice", ()).unwrap().compute(
+                1.0,
+                10.0,
+                0.0,
+                0.0,
+                10.0,
+                1.0
+            ),
+            (0.0, -99.0, 10.0, 100.0)
+        );
+
+        assert_eq!(
+            AspectRatio::parse("xMaxYMin meet", ()).unwrap().compute(
+                1.0,
+                10.0,
+                0.0,
+                0.0,
+                10.0,
+                1.0
+            ),
+            (9.9, 0.0, 0.1, 1.0)
+        );
+        assert_eq!(
+            AspectRatio::parse("xMaxYMin slice", ()).unwrap().compute(
+                1.0,
+                10.0,
+                0.0,
+                0.0,
+                10.0,
+                1.0
+            ),
+            (0.0, 0.0, 10.0, 100.0)
+        );
+
+        assert_eq!(
+            AspectRatio::parse("xMaxYMid meet", ()).unwrap().compute(
+                1.0,
+                10.0,
+                0.0,
+                0.0,
+                10.0,
+                1.0
+            ),
+            (9.9, 0.0, 0.1, 1.0)
+        );
+        assert_eq!(
+            AspectRatio::parse("xMaxYMid slice", ()).unwrap().compute(
+                1.0,
+                10.0,
+                0.0,
+                0.0,
+                10.0,
+                1.0
+            ),
+            (0.0, -49.5, 10.0, 100.0)
+        );
+
+        assert_eq!(
+            AspectRatio::parse("xMaxYMax meet", ()).unwrap().compute(
+                1.0,
+                10.0,
+                0.0,
+                0.0,
+                10.0,
+                1.0
+            ),
+            (9.9, 0.0, 0.1, 1.0)
+        );
+        assert_eq!(
+            AspectRatio::parse("xMaxYMax slice", ()).unwrap().compute(
+                1.0,
+                10.0,
+                0.0,
+                0.0,
+                10.0,
+                1.0
+            ),
+            (0.0, -99.0, 10.0, 100.0)
+        );
     }
 }
diff --git a/rsvg_internals/src/attributes.rs b/rsvg_internals/src/attributes.rs
index 65a55d4f..21e4f293 100644
--- a/rsvg_internals/src/attributes.rs
+++ b/rsvg_internals/src/attributes.rs
@@ -18,9 +18,10 @@ impl FromStr for Attribute {
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_attribute_from_name(raw_name: *const libc::c_char,
-                                           out_attr: *mut Attribute)
-                                           -> glib_sys::gboolean {
+pub extern "C" fn rsvg_attribute_from_name(
+    raw_name: *const libc::c_char,
+    out_attr: *mut Attribute,
+) -> glib_sys::gboolean {
     let name = unsafe { utf8_cstr(raw_name) };
 
     match Attribute::from_str(name) {
@@ -53,8 +54,10 @@ mod tests {
     #[test]
     fn c_attribute_from_name() {
         let mut a: Attribute = unsafe { mem::uninitialized() };
-        let res: bool =
-            from_glib(rsvg_attribute_from_name("width".to_glib_none().0, &mut a as *mut Attribute));
+        let res: bool = from_glib(rsvg_attribute_from_name(
+            "width".to_glib_none().0,
+            &mut a as *mut Attribute,
+        ));
         assert!(res);
         assert_eq!(a, Attribute::Width);
     }
@@ -62,8 +65,10 @@ mod tests {
     #[test]
     fn invalid_c_attribute_from_name() {
         let mut a: Attribute = unsafe { mem::uninitialized() };
-        let res: bool = from_glib(rsvg_attribute_from_name("foobar".to_glib_none().0,
-                                                           &mut a as *mut Attribute));
+        let res: bool = from_glib(rsvg_attribute_from_name(
+            "foobar".to_glib_none().0,
+            &mut a as *mut Attribute,
+        ));
         assert!(!res);
     }
 }
diff --git a/rsvg_internals/src/bbox.rs b/rsvg_internals/src/bbox.rs
index 73b570b2..4d785731 100644
--- a/rsvg_internals/src/bbox.rs
+++ b/rsvg_internals/src/bbox.rs
@@ -21,7 +21,7 @@ impl RsvgBbox {
 
     pub fn is_empty(&self) -> bool {
         from_glib(self.virgin) || double_equals(self.rect.width, 0.0)
-        || double_equals(self.rect.height, 0.0)
+            || double_equals(self.rect.height, 0.0)
     }
 }
 
@@ -49,7 +49,12 @@ pub extern "C" fn rsvg_bbox_insert(raw_dst: *mut RsvgBbox, raw_src: *const RsvgB
     }
 
     let (mut xmin, mut ymin, mut xmax, mut ymax) = if !dst.is_virgin() {
-        (dst.rect.x, dst.rect.y, (dst.rect.x + dst.rect.width), (dst.rect.y + dst.rect.height))
+        (
+            dst.rect.x,
+            dst.rect.y,
+            (dst.rect.x + dst.rect.width),
+            (dst.rect.y + dst.rect.height),
+        )
     } else {
         (0.0, 0.0, 0.0, 0.0)
     };
@@ -112,7 +117,12 @@ pub extern "C" fn rsvg_bbox_clip(raw_dst: *mut RsvgBbox, raw_src: *const RsvgBbo
     }
 
     let (mut xmin, mut ymin, mut xmax, mut ymax) = if !dst.is_virgin() {
-        ((dst.rect.x + dst.rect.width), (dst.rect.y + dst.rect.height), dst.rect.x, dst.rect.y)
+        (
+            (dst.rect.x + dst.rect.width),
+            (dst.rect.y + dst.rect.height),
+            dst.rect.x,
+            dst.rect.y,
+        )
     } else {
         (0.0, 0.0, 0.0, 0.0)
     };
diff --git a/rsvg_internals/src/clip_path.rs b/rsvg_internals/src/clip_path.rs
index fbb03fb9..07d7d581 100644
--- a/rsvg_internals/src/clip_path.rs
+++ b/rsvg_internals/src/clip_path.rs
@@ -17,7 +17,9 @@ struct NodeClipPath {
 
 impl NodeClipPath {
     fn new() -> NodeClipPath {
-        NodeClipPath { units: Cell::new(ClipPathUnits::default()), }
+        NodeClipPath {
+            units: Cell::new(ClipPathUnits::default()),
+        }
     }
 }
 
@@ -46,12 +48,15 @@ impl NodeTrait for NodeClipPath {
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_clip_path_new(_: *const libc::c_char,
-                                          raw_parent: *const RsvgNode)
-                                          -> *const RsvgNode {
-    boxed_node_new(NodeType::ClipPath,
-                   raw_parent,
-                   Box::new(NodeClipPath::new()))
+pub extern "C" fn rsvg_node_clip_path_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
+    boxed_node_new(
+        NodeType::ClipPath,
+        raw_parent,
+        Box::new(NodeClipPath::new()),
+    )
 }
 
 #[no_mangle]
@@ -62,8 +67,8 @@ pub extern "C" fn rsvg_node_clip_path_get_units(raw_node: *const RsvgNode) -> Co
     let mut units = ClipPathUnits::default();
 
     node.with_impl(|clip_path: &NodeClipPath| {
-                       units = clip_path.units.get();
-                   });
+        units = clip_path.units.get();
+    });
 
     CoordUnits::from(units)
 }
diff --git a/rsvg_internals/src/cnode.rs b/rsvg_internals/src/cnode.rs
index 728349a9..79fc94d9 100644
--- a/rsvg_internals/src/cnode.rs
+++ b/rsvg_internals/src/cnode.rs
@@ -6,14 +6,18 @@ use state::RsvgState;
 
 use std::rc::*;
 
-type CNodeSetAtts = unsafe extern "C" fn(node: *const RsvgNode,
- node_impl: *const RsvgCNodeImpl,
- handle: *const RsvgHandle,
- pbag: *const PropertyBag);
-type CNodeDraw = unsafe extern "C" fn(node: *const RsvgNode,
- node_impl: *const RsvgCNodeImpl,
- draw_ctx: *const RsvgDrawingCtx,
- dominate: i32);
+type CNodeSetAtts = unsafe extern "C" fn(
+    node: *const RsvgNode,
+    node_impl: *const RsvgCNodeImpl,
+    handle: *const RsvgHandle,
+    pbag: *const PropertyBag,
+);
+type CNodeDraw = unsafe extern "C" fn(
+    node: *const RsvgNode,
+    node_impl: *const RsvgCNodeImpl,
+    draw_ctx: *const RsvgDrawingCtx,
+    dominate: i32,
+);
 type CNodeFree = unsafe extern "C" fn(node_impl: *const RsvgCNodeImpl);
 
 struct CNode {
@@ -25,16 +29,19 @@ struct CNode {
 }
 
 impl NodeTrait for CNode {
-    fn set_atts(&self,
-                node: &RsvgNode,
-                handle: *const RsvgHandle,
-                pbag: &PropertyBag)
-                -> NodeResult {
+    fn set_atts(
+        &self,
+        node: &RsvgNode,
+        handle: *const RsvgHandle,
+        pbag: &PropertyBag,
+    ) -> NodeResult {
         unsafe {
-            (self.set_atts_fn)(node as *const RsvgNode,
-                               self.c_node_impl,
-                               handle,
-                               pbag.ffi());
+            (self.set_atts_fn)(
+                node as *const RsvgNode,
+                self.c_node_impl,
+                handle,
+                pbag.ffi(),
+            );
         }
 
         Ok(())
@@ -42,10 +49,12 @@ impl NodeTrait for CNode {
 
     fn draw(&self, node: &RsvgNode, draw_ctx: *const RsvgDrawingCtx, dominate: i32) {
         unsafe {
-            (self.draw_fn)(node as *const RsvgNode,
-                           self.c_node_impl,
-                           draw_ctx,
-                           dominate);
+            (self.draw_fn)(
+                node as *const RsvgNode,
+                self.c_node_impl,
+                draw_ctx,
+                dominate,
+            );
         }
     }
 
@@ -63,26 +72,31 @@ impl Drop for CNode {
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_rust_cnode_new(node_type: NodeType,
-                                      raw_parent: *const RsvgNode,
-                                      state: *mut RsvgState,
-                                      c_node_impl: *const RsvgCNodeImpl,
-                                      set_atts_fn: CNodeSetAtts,
-                                      draw_fn: CNodeDraw,
-                                      free_fn: CNodeFree)
-                                      -> *const RsvgNode {
+pub extern "C" fn rsvg_rust_cnode_new(
+    node_type: NodeType,
+    raw_parent: *const RsvgNode,
+    state: *mut RsvgState,
+    c_node_impl: *const RsvgCNodeImpl,
+    set_atts_fn: CNodeSetAtts,
+    draw_fn: CNodeDraw,
+    free_fn: CNodeFree,
+) -> *const RsvgNode {
     assert!(!state.is_null());
     assert!(!c_node_impl.is_null());
 
-    let cnode = CNode { c_node_impl,
-                        set_atts_fn,
-                        draw_fn,
-                        free_fn, };
+    let cnode = CNode {
+        c_node_impl,
+        set_atts_fn,
+        draw_fn,
+        free_fn,
+    };
 
-    box_node(Rc::new(Node::new(node_type,
-                               node_ptr_to_weak(raw_parent),
-                               state,
-                               Box::new(cnode))))
+    box_node(Rc::new(Node::new(
+        node_type,
+        node_ptr_to_weak(raw_parent),
+        state,
+        Box::new(cnode),
+    )))
 }
 
 #[no_mangle]
diff --git a/rsvg_internals/src/color.rs b/rsvg_internals/src/color.rs
index a24c0718..bbed55fe 100644
--- a/rsvg_internals/src/color.rs
+++ b/rsvg_internals/src/color.rs
@@ -65,14 +65,17 @@ impl Parse for Color {
     type Data = (AllowInherit, AllowCurrentColor);
     type Err = AttributeError;
 
-    fn parse(s: &str,
-             (allow_inherit, allow_current_color): (AllowInherit, AllowCurrentColor))
-             -> Result<Color, AttributeError> {
+    fn parse(
+        s: &str,
+        (allow_inherit, allow_current_color): (AllowInherit, AllowCurrentColor),
+    ) -> Result<Color, AttributeError> {
         if s == "inherit" {
             if allow_inherit == AllowInherit::Yes {
                 Ok(Color::Inherit)
             } else {
-                Err(AttributeError::Value("inherit is not allowed here".to_string()))
+                Err(AttributeError::Value(
+                    "inherit is not allowed here".to_string(),
+                ))
             }
         } else {
             let mut input = cssparser::ParserInput::new(s);
@@ -81,13 +84,17 @@ impl Parse for Color {
                     if allow_current_color == AllowCurrentColor::Yes {
                         Ok(Color::CurrentColor)
                     } else {
-                        Err(AttributeError::Value("currentColor is not allowed here".to_string()))
+                        Err(AttributeError::Value(
+                            "currentColor is not allowed here".to_string(),
+                        ))
                     }
                 }
 
                 Ok(csscolor) => Ok(Color::from(csscolor)),
 
-                _ => Err(AttributeError::Parse(ParseError::new("invalid syntax for color"))),
+                _ => Err(AttributeError::Parse(ParseError::new(
+                    "invalid syntax for color",
+                ))),
             }
         }
     }
@@ -96,26 +103,36 @@ impl Parse for Color {
 impl Color {
     pub fn from_color_spec(spec: &ColorSpec) -> Result<Color, AttributeError> {
         match *spec {
-            ColorSpec { kind: ColorKind::Inherit,
-                        .. } => Ok(Color::Inherit),
-
-            ColorSpec { kind: ColorKind::CurrentColor,
-                        .. } => Ok(Color::CurrentColor),
-
-            ColorSpec { kind: ColorKind::ARGB,
-                        argb, } => Ok(Color::RGBA(rgba_from_argb(argb))),
-
-            ColorSpec { kind: ColorKind::ParseError,
-                        .. } => Err(AttributeError::Parse(ParseError::new("parse error"))),
+            ColorSpec {
+                kind: ColorKind::Inherit,
+                ..
+            } => Ok(Color::Inherit),
+
+            ColorSpec {
+                kind: ColorKind::CurrentColor,
+                ..
+            } => Ok(Color::CurrentColor),
+
+            ColorSpec {
+                kind: ColorKind::ARGB,
+                argb,
+            } => Ok(Color::RGBA(rgba_from_argb(argb))),
+
+            ColorSpec {
+                kind: ColorKind::ParseError,
+                ..
+            } => Err(AttributeError::Parse(ParseError::new("parse error"))),
         }
     }
 }
 
 fn rgba_from_argb(argb: u32) -> cssparser::RGBA {
-    cssparser::RGBA::new(((argb & 0x00ff_0000) >> 16) as u8,
-                         ((argb & 0x0000_ff00) >> 8) as u8,
-                         (argb & 0x0000_00ff) as u8,
-                         ((argb & 0xff00_0000) >> 24) as u8)
+    cssparser::RGBA::new(
+        ((argb & 0x00ff_0000) >> 16) as u8,
+        ((argb & 0x0000_ff00) >> 8) as u8,
+        (argb & 0x0000_00ff) as u8,
+        ((argb & 0xff00_0000) >> 24) as u8,
+    )
 }
 
 impl From<cssparser::Color> for Color {
@@ -136,29 +153,36 @@ impl From<u32> for Color {
 impl From<Result<Color, AttributeError>> for ColorSpec {
     fn from(result: Result<Color, AttributeError>) -> ColorSpec {
         match result {
-            Ok(Color::Inherit) => ColorSpec { kind: ColorKind::Inherit,
-                                              argb: 0, },
-
-            Ok(Color::CurrentColor) => ColorSpec { kind: ColorKind::CurrentColor,
-                                                   argb: 0, },
-
-            Ok(Color::RGBA(rgba)) => ColorSpec { kind: ColorKind::ARGB,
-                                                 argb: (u32::from(rgba.alpha) << 24
-                                                        | u32::from(rgba.red) << 16
-                                                        | u32::from(rgba.green) << 8
-                                                        | u32::from(rgba.blue)), },
-
-            _ => ColorSpec { kind: ColorKind::ParseError,
-                             argb: 0, },
+            Ok(Color::Inherit) => ColorSpec {
+                kind: ColorKind::Inherit,
+                argb: 0,
+            },
+
+            Ok(Color::CurrentColor) => ColorSpec {
+                kind: ColorKind::CurrentColor,
+                argb: 0,
+            },
+
+            Ok(Color::RGBA(rgba)) => ColorSpec {
+                kind: ColorKind::ARGB,
+                argb: (u32::from(rgba.alpha) << 24 | u32::from(rgba.red) << 16
+                    | u32::from(rgba.green) << 8 | u32::from(rgba.blue)),
+            },
+
+            _ => ColorSpec {
+                kind: ColorKind::ParseError,
+                argb: 0,
+            },
         }
     }
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_css_parse_color(string: *const libc::c_char,
-                                       allow_inherit: AllowInherit,
-                                       allow_current_color: AllowCurrentColor)
-                                       -> ColorSpec {
+pub extern "C" fn rsvg_css_parse_color(
+    string: *const libc::c_char,
+    allow_inherit: AllowInherit,
+    allow_current_color: AllowCurrentColor,
+) -> ColorSpec {
     let s = unsafe { utf8_cstr(string) };
 
     ColorSpec::from(Color::parse(s, (allow_inherit, allow_current_color)))
@@ -171,63 +195,111 @@ mod tests {
 
     fn parse(s: &str) -> ColorSpec {
         // ColorSpec::from (Color::parse (s, (AllowInherit::Yes, AllowCurrentColor::Yes)))
-        rsvg_css_parse_color(s.to_glib_none().0,
-                             AllowInherit::Yes,
-                             AllowCurrentColor::Yes)
+        rsvg_css_parse_color(
+            s.to_glib_none().0,
+            AllowInherit::Yes,
+            AllowCurrentColor::Yes,
+        )
     }
 
     #[test]
     fn parses_hash_hex_colors() {
-        assert_eq!(parse("#AB10fa20"),
-                   ColorSpec { kind: ColorKind::ARGB,
-                               argb: 0x20ab10fa, });
-        assert_eq!(parse("#10fa20"),
-                   ColorSpec { kind: ColorKind::ARGB,
-                               argb: 0xff10fa20, });
-        assert_eq!(parse("#abcd"),
-                   ColorSpec { kind: ColorKind::ARGB,
-                               argb: 0xddaabbcc, });
-        assert_eq!(parse("#123"),
-                   ColorSpec { kind: ColorKind::ARGB,
-                               argb: 0xff112233, });
+        assert_eq!(
+            parse("#AB10fa20"),
+            ColorSpec {
+                kind: ColorKind::ARGB,
+                argb: 0x20ab10fa,
+            }
+        );
+        assert_eq!(
+            parse("#10fa20"),
+            ColorSpec {
+                kind: ColorKind::ARGB,
+                argb: 0xff10fa20,
+            }
+        );
+        assert_eq!(
+            parse("#abcd"),
+            ColorSpec {
+                kind: ColorKind::ARGB,
+                argb: 0xddaabbcc,
+            }
+        );
+        assert_eq!(
+            parse("#123"),
+            ColorSpec {
+                kind: ColorKind::ARGB,
+                argb: 0xff112233,
+            }
+        );
     }
 
     #[test]
     fn parses_color_keywords() {
-        assert_eq!(parse("red"),
-                   ColorSpec { kind: ColorKind::ARGB,
-                               argb: 0xffff0000, });
-        assert_eq!(parse("lime"),
-                   ColorSpec { kind: ColorKind::ARGB,
-                               argb: 0xff00ff00, });
-        assert_eq!(parse("blue"),
-                   ColorSpec { kind: ColorKind::ARGB,
-                               argb: 0xff0000ff, });
+        assert_eq!(
+            parse("red"),
+            ColorSpec {
+                kind: ColorKind::ARGB,
+                argb: 0xffff0000,
+            }
+        );
+        assert_eq!(
+            parse("lime"),
+            ColorSpec {
+                kind: ColorKind::ARGB,
+                argb: 0xff00ff00,
+            }
+        );
+        assert_eq!(
+            parse("blue"),
+            ColorSpec {
+                kind: ColorKind::ARGB,
+                argb: 0xff0000ff,
+            }
+        );
     }
 
     #[test]
     fn parses_color_functions() {
-        assert_eq!(parse("rgb(255, 0, 0)"),
-                   ColorSpec { kind: ColorKind::ARGB,
-                               argb: 0xffff0000, });
-        assert_eq!(parse("rgb(0, 255, 0)"),
-                   ColorSpec { kind: ColorKind::ARGB,
-                               argb: 0xff00ff00, });
-        assert_eq!(parse("rgb(0, 0, 255)"),
-                   ColorSpec { kind: ColorKind::ARGB,
-                               argb: 0xff0000ff, });
+        assert_eq!(
+            parse("rgb(255, 0, 0)"),
+            ColorSpec {
+                kind: ColorKind::ARGB,
+                argb: 0xffff0000,
+            }
+        );
+        assert_eq!(
+            parse("rgb(0, 255, 0)"),
+            ColorSpec {
+                kind: ColorKind::ARGB,
+                argb: 0xff00ff00,
+            }
+        );
+        assert_eq!(
+            parse("rgb(0, 0, 255)"),
+            ColorSpec {
+                kind: ColorKind::ARGB,
+                argb: 0xff0000ff,
+            }
+        );
     }
 
     #[test]
     fn parses_current_color() {
-        assert_eq!(parse("currentColor"),
-                   ColorSpec { kind: ColorKind::CurrentColor,
-                               argb: 0, });
+        assert_eq!(
+            parse("currentColor"),
+            ColorSpec {
+                kind: ColorKind::CurrentColor,
+                argb: 0,
+            }
+        );
     }
 
     fn make_error() -> ColorSpec {
-        ColorSpec { kind: ColorKind::ParseError,
-                    argb: 0, }
+        ColorSpec {
+            kind: ColorKind::ParseError,
+            argb: 0,
+        }
     }
 
     #[test]
@@ -247,16 +319,24 @@ mod tests {
 
     #[test]
     fn yields_error_on_disallowed_current_color() {
-        assert_eq!(ColorSpec::from(Color::parse("currentColor",
-                                                (AllowInherit::Yes, AllowCurrentColor::No))),
-                   make_error());
+        assert_eq!(
+            ColorSpec::from(Color::parse(
+                "currentColor",
+                (AllowInherit::Yes, AllowCurrentColor::No)
+            )),
+            make_error()
+        );
     }
 
     #[test]
     fn yields_error_on_disallowed_inherit() {
-        assert_eq!(ColorSpec::from(Color::parse("inherit",
-                                                (AllowInherit::No, AllowCurrentColor::Yes))),
-                   make_error());
+        assert_eq!(
+            ColorSpec::from(Color::parse(
+                "inherit",
+                (AllowInherit::No, AllowCurrentColor::Yes)
+            )),
+            make_error()
+        );
     }
 
     fn test_roundtrip(s: &str) {
@@ -281,7 +361,9 @@ mod tests {
 
     #[test]
     fn from_argb() {
-        assert_eq!(Color::from(0xaabbccdd),
-                   Color::RGBA(cssparser::RGBA::new(0xbb, 0xcc, 0xdd, 0xaa)));
+        assert_eq!(
+            Color::from(0xaabbccdd),
+            Color::RGBA(cssparser::RGBA::new(0xbb, 0xcc, 0xdd, 0xaa))
+        );
     }
 }
diff --git a/rsvg_internals/src/coord_units.rs b/rsvg_internals/src/coord_units.rs
index 7fd7199e..b2ddc7cd 100644
--- a/rsvg_internals/src/coord_units.rs
+++ b/rsvg_internals/src/coord_units.rs
@@ -21,8 +21,9 @@ impl Parse for CoordUnits {
         match s {
             "userSpaceOnUse" => Ok(CoordUnits::UserSpaceOnUse),
             "objectBoundingBox" => Ok(CoordUnits::ObjectBoundingBox),
-            _ => Err(AttributeError::Parse(ParseError::new("expected 'userSpaceOnUse' or \
-                                                            'objectBoundingBox'"))),
+            _ => Err(AttributeError::Parse(ParseError::new(
+                "expected 'userSpaceOnUse' or 'objectBoundingBox'",
+            ))),
         }
     }
 }
@@ -78,10 +79,14 @@ mod tests {
 
     #[test]
     fn parses_paint_server_units() {
-        assert_eq!(MyUnits::parse("userSpaceOnUse", ()),
-                   Ok(MyUnits(CoordUnits::UserSpaceOnUse)));
-        assert_eq!(MyUnits::parse("objectBoundingBox", ()),
-                   Ok(MyUnits(CoordUnits::ObjectBoundingBox)));
+        assert_eq!(
+            MyUnits::parse("userSpaceOnUse", ()),
+            Ok(MyUnits(CoordUnits::UserSpaceOnUse))
+        );
+        assert_eq!(
+            MyUnits::parse("objectBoundingBox", ()),
+            Ok(MyUnits(CoordUnits::ObjectBoundingBox))
+        );
     }
 
     #[test]
@@ -91,7 +96,9 @@ mod tests {
 
     #[test]
     fn converts_to_coord_units() {
-        assert_eq!(CoordUnits::from(MyUnits(CoordUnits::ObjectBoundingBox)),
-                   CoordUnits::ObjectBoundingBox);
+        assert_eq!(
+            CoordUnits::from(MyUnits(CoordUnits::ObjectBoundingBox)),
+            CoordUnits::ObjectBoundingBox
+        );
     }
 }
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index 80f26871..f7cf6ef5 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -17,48 +17,61 @@ use state::RsvgState;
 pub enum RsvgDrawingCtx {}
 
 extern "C" {
-    fn rsvg_drawing_ctx_get_dpi(draw_ctx: *const RsvgDrawingCtx,
-                                out_dpi_x: *mut f64,
-                                out_dpi_y: *mut f64);
+    fn rsvg_drawing_ctx_get_dpi(
+        draw_ctx: *const RsvgDrawingCtx,
+        out_dpi_x: *mut f64,
+        out_dpi_y: *mut f64,
+    );
 
     fn rsvg_drawing_ctx_get_normalized_font_size(draw_ctx: *const RsvgDrawingCtx) -> f64;
 
-    fn rsvg_drawing_ctx_get_view_box_size(draw_ctx: *const RsvgDrawingCtx,
-                                          out_x: *mut f64,
-                                          out_y: *mut f64);
+    fn rsvg_drawing_ctx_get_view_box_size(
+        draw_ctx: *const RsvgDrawingCtx,
+        out_x: *mut f64,
+        out_y: *mut f64,
+    );
 
     fn rsvg_drawing_ctx_push_view_box(draw_ctx: *const RsvgDrawingCtx, width: f64, height: f64);
 
     fn rsvg_drawing_ctx_pop_view_box(draw_ctx: *const RsvgDrawingCtx);
 
-    fn rsvg_drawing_ctx_acquire_node(draw_ctx: *const RsvgDrawingCtx,
-                                     url: *const libc::c_char)
-                                     -> *mut RsvgNode;
+    fn rsvg_drawing_ctx_acquire_node(
+        draw_ctx: *const RsvgDrawingCtx,
+        url: *const libc::c_char,
+    ) -> *mut RsvgNode;
 
-    fn rsvg_drawing_ctx_acquire_node_of_type(draw_ctx: *const RsvgDrawingCtx,
-                                             url: *const libc::c_char,
-                                             node_type: NodeType)
-                                             -> *mut RsvgNode;
+    fn rsvg_drawing_ctx_acquire_node_of_type(
+        draw_ctx: *const RsvgDrawingCtx,
+        url: *const libc::c_char,
+        node_type: NodeType,
+    ) -> *mut RsvgNode;
 
     fn rsvg_drawing_ctx_release_node(draw_ctx: *const RsvgDrawingCtx, node: *mut RsvgNode);
 
     fn rsvg_drawing_ctx_get_current_state_affine(draw_ctx: *const RsvgDrawingCtx) -> cairo::Matrix;
 
-    fn rsvg_drawing_ctx_set_current_state_affine(draw_ctx: *const RsvgDrawingCtx,
-                                                 affine: *const cairo::Matrix);
-
-    fn rsvg_drawing_ctx_get_pango_context(draw_ctx: *const RsvgDrawingCtx)
-                                          -> *mut pango_sys::PangoContext;
-
-    fn rsvg_drawing_ctx_add_clipping_rect(draw_ctx: *const RsvgDrawingCtx,
-                                          x: f64,
-                                          y: f64,
-                                          w: f64,
-                                          h: f64);
-
-    fn rsvg_drawing_ctx_draw_node_from_stack(draw_ctx: *const RsvgDrawingCtx,
-                                             node: *const RsvgNode,
-                                             dominate: i32);
+    fn rsvg_drawing_ctx_set_current_state_affine(
+        draw_ctx: *const RsvgDrawingCtx,
+        affine: *const cairo::Matrix,
+    );
+
+    fn rsvg_drawing_ctx_get_pango_context(
+        draw_ctx: *const RsvgDrawingCtx,
+    ) -> *mut pango_sys::PangoContext;
+
+    fn rsvg_drawing_ctx_add_clipping_rect(
+        draw_ctx: *const RsvgDrawingCtx,
+        x: f64,
+        y: f64,
+        w: f64,
+        h: f64,
+    );
+
+    fn rsvg_drawing_ctx_draw_node_from_stack(
+        draw_ctx: *const RsvgDrawingCtx,
+        node: *const RsvgNode,
+        dominate: i32,
+    );
 
     fn rsvg_current_state(draw_ctx: *const RsvgDrawingCtx) -> *mut RsvgState;
     fn rsvg_state_new() -> *mut RsvgState;
@@ -76,20 +89,24 @@ extern "C" {
     fn rsvg_state_push(draw_ctx: *const RsvgDrawingCtx);
     fn rsvg_state_pop(draw_ctx: *const RsvgDrawingCtx);
 
-    fn rsvg_state_reinherit_top(draw_ctx: *const RsvgDrawingCtx,
-                                state: *mut RsvgState,
-                                dominate: libc::c_int);
+    fn rsvg_state_reinherit_top(
+        draw_ctx: *const RsvgDrawingCtx,
+        state: *mut RsvgState,
+        dominate: libc::c_int,
+    );
 
     fn rsvg_push_discrete_layer(draw_ctx: *const RsvgDrawingCtx);
     fn rsvg_pop_discrete_layer(draw_ctx: *const RsvgDrawingCtx);
 
     fn rsvg_render_path_builder(draw_ctx: *const RsvgDrawingCtx, builder: *const RsvgPathBuilder);
-    fn rsvg_render_surface(draw_ctx: *const RsvgDrawingCtx,
-                           surface: *const cairo_sys::cairo_surface_t,
-                           x: f64,
-                           y: f64,
-                           w: f64,
-                           h: f64);
+    fn rsvg_render_surface(
+        draw_ctx: *const RsvgDrawingCtx,
+        surface: *const cairo_sys::cairo_surface_t,
+        x: f64,
+        y: f64,
+        w: f64,
+        h: f64,
+    );
 
     fn rsvg_cairo_get_cairo_context(draw_ctx: *const RsvgDrawingCtx) -> *mut cairo_sys::cairo_t;
     fn rsvg_cairo_set_cairo_context(draw_ctx: *const RsvgDrawingCtx, cr: *const cairo_sys::cairo_t);
@@ -137,10 +154,11 @@ pub fn acquire_node(draw_ctx: *const RsvgDrawingCtx, url: &str) -> *mut RsvgNode
     unsafe { rsvg_drawing_ctx_acquire_node(draw_ctx, str::to_glib_none(url).0) }
 }
 
-pub fn acquire_node_of_type(draw_ctx: *const RsvgDrawingCtx,
-                            url: &str,
-                            node_type: NodeType)
-                            -> *mut RsvgNode {
+pub fn acquire_node_of_type(
+    draw_ctx: *const RsvgDrawingCtx,
+    url: &str,
+    node_type: NodeType,
+) -> *mut RsvgNode {
     unsafe { rsvg_drawing_ctx_acquire_node_of_type(draw_ctx, str::to_glib_none(url).0, node_type) }
 }
 
@@ -174,12 +192,14 @@ pub fn render_path_builder(draw_ctx: *const RsvgDrawingCtx, builder: &RsvgPathBu
     }
 }
 
-pub fn render_surface(draw_ctx: *const RsvgDrawingCtx,
-                      surface: &cairo::ImageSurface,
-                      x: f64,
-                      y: f64,
-                      w: f64,
-                      h: f64) {
+pub fn render_surface(
+    draw_ctx: *const RsvgDrawingCtx,
+    surface: &cairo::ImageSurface,
+    x: f64,
+    y: f64,
+    w: f64,
+    h: f64,
+) {
     unsafe {
         rsvg_render_surface(draw_ctx, surface.to_raw_none(), x, y, w, h);
     }
diff --git a/rsvg_internals/src/error.rs b/rsvg_internals/src/error.rs
index 4ca02106..62e038fd 100644
--- a/rsvg_internals/src/error.rs
+++ b/rsvg_internals/src/error.rs
@@ -22,18 +22,24 @@ pub struct NodeError {
 
 impl NodeError {
     pub fn parse_error(attr_name: &str, error: ParseError) -> NodeError {
-        NodeError { attr_name: attr_name.to_string(),
-                    err: AttributeError::Parse(error), }
+        NodeError {
+            attr_name: attr_name.to_string(),
+            err: AttributeError::Parse(error),
+        }
     }
 
     pub fn value_error(attr_name: &str, description: &str) -> NodeError {
-        NodeError { attr_name: attr_name.to_string(),
-                    err: AttributeError::Value(description.to_string()), }
+        NodeError {
+            attr_name: attr_name.to_string(),
+            err: AttributeError::Value(description.to_string()),
+        }
     }
 
     pub fn attribute_error(attr_name: &str, error: AttributeError) -> NodeError {
-        NodeError { attr_name: attr_name.to_string(),
-                    err: error, }
+        NodeError {
+            attr_name: attr_name.to_string(),
+            err: error,
+        }
     }
 }
 
@@ -49,13 +55,17 @@ impl error::Error for NodeError {
 impl fmt::Display for NodeError {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match self.err {
-            AttributeError::Parse(ref n) => write!(f,
-                                                   "error parsing value for attribute \"{}\": {}",
-                                                   self.attr_name, n.display),
+            AttributeError::Parse(ref n) => write!(
+                f,
+                "error parsing value for attribute \"{}\": {}",
+                self.attr_name, n.display
+            ),
 
-            AttributeError::Value(ref s) => write!(f,
-                                                   "invalid value for attribute \"{}\": {}",
-                                                   self.attr_name, s),
+            AttributeError::Value(ref s) => write!(
+                f,
+                "invalid value for attribute \"{}\": {}",
+                self.attr_name, s
+            ),
         }
     }
 }
diff --git a/rsvg_internals/src/gradient.rs b/rsvg_internals/src/gradient.rs
index 5f43b9cc..7ae4f716 100644
--- a/rsvg_internals/src/gradient.rs
+++ b/rsvg_internals/src/gradient.rs
@@ -65,11 +65,13 @@ struct Gradient {
 
 impl Default for GradientCommon {
     fn default() -> GradientCommon {
-        GradientCommon { units: Some(GradientUnits::default()),
-                         affine: Some(cairo::Matrix::identity()),
-                         spread: Some(PaintServerSpread::default()),
-                         fallback: None,
-                         stops: Some(Vec::<ColorStop>::new()), }
+        GradientCommon {
+            units: Some(GradientUnits::default()),
+            affine: Some(cairo::Matrix::identity()),
+            spread: Some(PaintServerSpread::default()),
+            fallback: None,
+            stops: Some(Vec::<ColorStop>::new()),
+        }
     }
 }
 
@@ -98,11 +100,13 @@ macro_rules! fallback_to (
 
 impl GradientCommon {
     fn unresolved() -> GradientCommon {
-        GradientCommon { units: None,
-                         affine: None,
-                         spread: None,
-                         fallback: None,
-                         stops: None, }
+        GradientCommon {
+            units: None,
+            affine: None,
+            spread: None,
+            fallback: None,
+            stops: None,
+        }
     }
 
     fn clone_stops(&self) -> Option<Vec<ColorStop>> {
@@ -115,7 +119,7 @@ impl GradientCommon {
 
     fn is_resolved(&self) -> bool {
         self.units.is_some() && self.affine.is_some() && self.spread.is_some()
-        && self.stops.is_some()
+            && self.stops.is_some()
     }
 
     fn resolve_from_defaults(&mut self) {
@@ -156,18 +160,22 @@ impl GradientCommon {
 
 impl GradientVariant {
     fn unresolved_linear() -> Self {
-        GradientVariant::Linear { x1: None,
-                                  y1: None,
-                                  x2: None,
-                                  y2: None, }
+        GradientVariant::Linear {
+            x1: None,
+            y1: None,
+            x2: None,
+            y2: None,
+        }
     }
 
     fn unresolved_radial() -> Self {
-        GradientVariant::Radial { cx: None,
-                                  cy: None,
-                                  r: None,
-                                  fx: None,
-                                  fy: None, }
+        GradientVariant::Radial {
+            cx: None,
+            cy: None,
+            r: None,
+            fx: None,
+            fy: None,
+        }
     }
 
     fn is_resolved(&self) -> bool {
@@ -196,14 +204,14 @@ impl GradientVariant {
     fn default_radial() -> Self {
         // https://www.w3.org/TR/SVG/pservers.html#RadialGradients
 
-        GradientVariant::Radial { cx:
-                                      Some(RsvgLength::parse("50%", LengthDir::Horizontal).unwrap()),
-                                  cy:
-                                      Some(RsvgLength::parse("50%", LengthDir::Vertical).unwrap()),
-                                  r: Some(RsvgLength::parse("50%", LengthDir::Both).unwrap()),
+        GradientVariant::Radial {
+            cx: Some(RsvgLength::parse("50%", LengthDir::Horizontal).unwrap()),
+            cy: Some(RsvgLength::parse("50%", LengthDir::Vertical).unwrap()),
+            r: Some(RsvgLength::parse("50%", LengthDir::Both).unwrap()),
 
-                                  fx: None,
-                                  fy: None, }
+            fx: None,
+            fy: None,
+        }
     }
 
     fn resolve_from_defaults(&mut self) {
@@ -218,11 +226,13 @@ impl GradientVariant {
             }
         }
 
-        if let GradientVariant::Radial { cx,
-                                         cy,
-                                         ref mut fx,
-                                         ref mut fy,
-                                         .. } = *self
+        if let GradientVariant::Radial {
+            cx,
+            cy,
+            ref mut fx,
+            ref mut fy,
+            ..
+        } = *self
         {
             // fx and fy fall back to the presentational value of cx and cy
             fallback_to!(*fx, cx);
@@ -232,14 +242,18 @@ impl GradientVariant {
 
     fn resolve_from_fallback(&mut self, fallback: &GradientVariant) {
         match *self {
-            GradientVariant::Linear { ref mut x1,
-                                      ref mut y1,
-                                      ref mut x2,
-                                      ref mut y2, } => {
-                if let GradientVariant::Linear { x1: x1f,
-                                                 y1: y1f,
-                                                 x2: x2f,
-                                                 y2: y2f, } = *fallback
+            GradientVariant::Linear {
+                ref mut x1,
+                ref mut y1,
+                ref mut x2,
+                ref mut y2,
+            } => {
+                if let GradientVariant::Linear {
+                    x1: x1f,
+                    y1: y1f,
+                    x2: x2f,
+                    y2: y2f,
+                } = *fallback
                 {
                     fallback_to!(*x1, x1f);
                     fallback_to!(*y1, y1f);
@@ -248,16 +262,20 @@ impl GradientVariant {
                 }
             }
 
-            GradientVariant::Radial { ref mut cx,
-                                      ref mut cy,
-                                      ref mut r,
-                                      ref mut fx,
-                                      ref mut fy, } => {
-                if let GradientVariant::Radial { cx: cxf,
-                                                 cy: cyf,
-                                                 r: rf,
-                                                 fx: fxf,
-                                                 fy: fyf, } = *fallback
+            GradientVariant::Radial {
+                ref mut cx,
+                ref mut cy,
+                ref mut r,
+                ref mut fx,
+                ref mut fy,
+            } => {
+                if let GradientVariant::Radial {
+                    cx: cxf,
+                    cy: cyf,
+                    r: rf,
+                    fx: fxf,
+                    fy: fyf,
+                } = *fallback
                 {
                     fallback_to!(*cx, cxf);
                     fallback_to!(*cy, cyf);
@@ -286,20 +304,22 @@ impl Gradient {
     }
 
     fn add_color_stops_from_node(&mut self, node: &RsvgNode) {
-        assert!(node.get_type() == NodeType::LinearGradient
-                || node.get_type() == NodeType::RadialGradient);
+        assert!(
+            node.get_type() == NodeType::LinearGradient
+                || node.get_type() == NodeType::RadialGradient
+        );
 
         node.foreach_child(|child| {
-            if child.get_type () != NodeType::Stop {
+            if child.get_type() != NodeType::Stop {
                 return true; // just ignore this child; we are only interested in gradient stops
             }
 
-            if child.get_result ().is_err () {
+            if child.get_result().is_err() {
                 return false; // don't add any more stops
             }
 
-            child.with_impl (|stop: &NodeStop| {
-                self.add_color_stop (stop.get_offset (), stop.get_rgba ());
+            child.with_impl(|stop: &NodeStop| {
+                self.add_color_stop(stop.get_offset(), stop.get_rgba());
             });
 
             true
@@ -314,12 +334,13 @@ impl Gradient {
         if let Some(stops) = self.common.stops.as_ref() {
             for stop in stops {
                 let rgba = stop.rgba;
-                pattern.add_color_stop_rgba(stop.offset,
-                                            (f64::from((rgba >> 24) & 0xff)) / 255.0,
-                                            (f64::from((rgba >> 16) & 0xff)) / 255.0,
-                                            (f64::from((rgba >> 8) & 0xff)) / 255.0,
-                                            f64::from((rgba & 0xff) * u32::from(opacity)) / 255.0
-                                            / 255.0);
+                pattern.add_color_stop_rgba(
+                    stop.offset,
+                    (f64::from((rgba >> 24) & 0xff)) / 255.0,
+                    (f64::from((rgba >> 16) & 0xff)) / 255.0,
+                    (f64::from((rgba >> 8) & 0xff)) / 255.0,
+                    f64::from((rgba & 0xff) * u32::from(opacity)) / 255.0 / 255.0,
+                );
             }
         }
     }
@@ -340,9 +361,9 @@ fn resolve_gradient(gradient: &Gradient, fallback_source: &mut FallbackSource) -
         }
 
         if let Some(fallback_node) = opt_fallback {
-            fallback_node.with_impl (|i: &NodeGradient| {
-                let fallback_gradient = i.get_gradient_with_color_stops_from_node (&fallback_node);
-                result.resolve_from_fallback (&fallback_gradient)
+            fallback_node.with_impl(|i: &NodeGradient| {
+                let fallback_gradient = i.get_gradient_with_color_stops_from_node(&fallback_node);
+                result.resolve_from_fallback(&fallback_gradient)
             });
         } else {
             result.resolve_from_defaults();
@@ -360,8 +381,10 @@ struct NodeFallbackSource {
 
 impl NodeFallbackSource {
     fn new(draw_ctx: *mut RsvgDrawingCtx) -> NodeFallbackSource {
-        NodeFallbackSource { draw_ctx,
-                             acquired_nodes: Vec::<*mut RsvgNode>::new(), }
+        NodeFallbackSource {
+            draw_ctx,
+            acquired_nodes: Vec::<*mut RsvgNode>::new(),
+        }
     }
 }
 
@@ -383,7 +406,7 @@ impl FallbackSource for NodeFallbackSource {
 
         let node: &RsvgNode = unsafe { &*fallback_node };
         if !(node.get_type() == NodeType::LinearGradient
-             || node.get_type() == NodeType::RadialGradient)
+            || node.get_type() == NodeType::RadialGradient)
         {
             return None;
         }
@@ -394,11 +417,13 @@ impl FallbackSource for NodeFallbackSource {
     }
 }
 
-fn set_common_on_pattern<P: cairo::Pattern + cairo::Gradient>(gradient: &Gradient,
-                                                              draw_ctx: *mut RsvgDrawingCtx,
-                                                              pattern: &mut P,
-                                                              bbox: &RsvgBbox,
-                                                              opacity: u8) {
+fn set_common_on_pattern<P: cairo::Pattern + cairo::Gradient>(
+    gradient: &Gradient,
+    draw_ctx: *mut RsvgDrawingCtx,
+    pattern: &mut P,
+    bbox: &RsvgBbox,
+    opacity: u8,
+) {
     let cr = drawing_ctx::get_cairo_context(draw_ctx);
 
     let mut affine = gradient.common.affine.unwrap();
@@ -406,12 +431,14 @@ fn set_common_on_pattern<P: cairo::Pattern + cairo::Gradient>(gradient: &Gradien
     let units = gradient.common.units.unwrap();
 
     if units == GradientUnits(CoordUnits::ObjectBoundingBox) {
-        let bbox_matrix = cairo::Matrix::new(bbox.rect.width,
-                                             0.0,
-                                             0.0,
-                                             bbox.rect.height,
-                                             bbox.rect.x,
-                                             bbox.rect.y);
+        let bbox_matrix = cairo::Matrix::new(
+            bbox.rect.width,
+            0.0,
+            0.0,
+            bbox.rect.height,
+            bbox.rect.x,
+            bbox.rect.y,
+        );
         affine = cairo::Matrix::multiply(&affine, &bbox_matrix);
     }
 
@@ -424,11 +451,12 @@ fn set_common_on_pattern<P: cairo::Pattern + cairo::Gradient>(gradient: &Gradien
     cr.set_source(pattern);
 }
 
-fn set_linear_gradient_on_pattern(gradient: &Gradient,
-                                  draw_ctx: *mut RsvgDrawingCtx,
-                                  bbox: &RsvgBbox,
-                                  opacity: u8)
-                                  -> bool {
+fn set_linear_gradient_on_pattern(
+    gradient: &Gradient,
+    draw_ctx: *mut RsvgDrawingCtx,
+    bbox: &RsvgBbox,
+    opacity: u8,
+) -> bool {
     if let GradientVariant::Linear { x1, y1, x2, y2 } = gradient.variant {
         let units = gradient.common.units.unwrap();
 
@@ -436,10 +464,12 @@ fn set_linear_gradient_on_pattern(gradient: &Gradient,
             drawing_ctx::push_view_box(draw_ctx, 1.0, 1.0);
         }
 
-        let mut pattern = cairo::LinearGradient::new(x1.as_ref().unwrap().normalize(draw_ctx),
-                                                     y1.as_ref().unwrap().normalize(draw_ctx),
-                                                     x2.as_ref().unwrap().normalize(draw_ctx),
-                                                     y2.as_ref().unwrap().normalize(draw_ctx));
+        let mut pattern = cairo::LinearGradient::new(
+            x1.as_ref().unwrap().normalize(draw_ctx),
+            y1.as_ref().unwrap().normalize(draw_ctx),
+            x2.as_ref().unwrap().normalize(draw_ctx),
+            y2.as_ref().unwrap().normalize(draw_ctx),
+        );
 
         if units == GradientUnits(CoordUnits::ObjectBoundingBox) {
             drawing_ctx::pop_view_box(draw_ctx);
@@ -500,11 +530,12 @@ fn fix_focus_point(mut fx: f64, mut fy: f64, cx: f64, cy: f64, radius: f64) -> (
     (vx + cx, vy + cy)
 }
 
-fn set_radial_gradient_on_pattern(gradient: &Gradient,
-                                  draw_ctx: *mut RsvgDrawingCtx,
-                                  bbox: &RsvgBbox,
-                                  opacity: u8)
-                                  -> bool {
+fn set_radial_gradient_on_pattern(
+    gradient: &Gradient,
+    draw_ctx: *mut RsvgDrawingCtx,
+    bbox: &RsvgBbox,
+    opacity: u8,
+) -> bool {
     if let GradientVariant::Radial { cx, cy, r, fx, fy } = gradient.variant {
         let units = gradient.common.units.unwrap();
 
@@ -534,11 +565,12 @@ fn set_radial_gradient_on_pattern(gradient: &Gradient,
     true
 }
 
-fn set_pattern_on_draw_context(gradient: &Gradient,
-                               draw_ctx: *mut RsvgDrawingCtx,
-                               opacity: u8,
-                               bbox: &RsvgBbox)
-                               -> bool {
+fn set_pattern_on_draw_context(
+    gradient: &Gradient,
+    draw_ctx: *mut RsvgDrawingCtx,
+    opacity: u8,
+    bbox: &RsvgBbox,
+) -> bool {
     assert!(gradient.is_resolved());
 
     match gradient.variant {
@@ -558,15 +590,21 @@ struct NodeGradient {
 
 impl NodeGradient {
     fn new_linear() -> NodeGradient {
-        NodeGradient { gradient: RefCell::new(Gradient { common: GradientCommon::unresolved(),
-                                                         variant:
-                                                             GradientVariant::unresolved_linear(), }), }
+        NodeGradient {
+            gradient: RefCell::new(Gradient {
+                common: GradientCommon::unresolved(),
+                variant: GradientVariant::unresolved_linear(),
+            }),
+        }
     }
 
     fn new_radial() -> NodeGradient {
-        NodeGradient { gradient: RefCell::new(Gradient { common: GradientCommon::unresolved(),
-                                                         variant:
-                                                             GradientVariant::unresolved_radial(), }), }
+        NodeGradient {
+            gradient: RefCell::new(Gradient {
+                common: GradientCommon::unresolved(),
+                variant: GradientVariant::unresolved_radial(),
+            }),
+        }
     }
 
     fn get_gradient_with_color_stops_from_node(&self, node: &RsvgNode) -> Gradient {
@@ -650,28 +688,35 @@ impl NodeTrait for NodeGradient {
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_linear_gradient_new(_: *const libc::c_char,
-                                                raw_parent: *const RsvgNode)
-                                                -> *const RsvgNode {
-    boxed_node_new(NodeType::LinearGradient,
-                   raw_parent,
-                   Box::new(NodeGradient::new_linear()))
+pub extern "C" fn rsvg_node_linear_gradient_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
+    boxed_node_new(
+        NodeType::LinearGradient,
+        raw_parent,
+        Box::new(NodeGradient::new_linear()),
+    )
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_radial_gradient_new(_: *const libc::c_char,
-                                                raw_parent: *const RsvgNode)
-                                                -> *const RsvgNode {
-    boxed_node_new(NodeType::RadialGradient,
-                   raw_parent,
-                   Box::new(NodeGradient::new_radial()))
+pub extern "C" fn rsvg_node_radial_gradient_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
+    boxed_node_new(
+        NodeType::RadialGradient,
+        raw_parent,
+        Box::new(NodeGradient::new_radial()),
+    )
 }
 
-fn resolve_fallbacks_and_set_pattern(gradient: &Gradient,
-                                     draw_ctx: *mut RsvgDrawingCtx,
-                                     opacity: u8,
-                                     bbox: &RsvgBbox)
-                                     -> bool {
+fn resolve_fallbacks_and_set_pattern(
+    gradient: &Gradient,
+    draw_ctx: *mut RsvgDrawingCtx,
+    opacity: u8,
+    bbox: &RsvgBbox,
+) -> bool {
     let mut fallback_source = NodeFallbackSource::new(draw_ctx);
 
     if bbox.is_empty() {
@@ -683,21 +728,22 @@ fn resolve_fallbacks_and_set_pattern(gradient: &Gradient,
     set_pattern_on_draw_context(&resolved, draw_ctx, opacity, &bbox)
 }
 
-pub fn gradient_resolve_fallbacks_and_set_pattern(node: &RsvgNode,
-                                                  draw_ctx: *mut RsvgDrawingCtx,
-                                                  opacity: u8,
-                                                  bbox: &RsvgBbox)
-                                                  -> bool {
-    assert!(node.get_type() == NodeType::LinearGradient
-            || node.get_type() == NodeType::RadialGradient);
+pub fn gradient_resolve_fallbacks_and_set_pattern(
+    node: &RsvgNode,
+    draw_ctx: *mut RsvgDrawingCtx,
+    opacity: u8,
+    bbox: &RsvgBbox,
+) -> bool {
+    assert!(
+        node.get_type() == NodeType::LinearGradient || node.get_type() == NodeType::RadialGradient
+    );
 
     let mut did_set_gradient = false;
 
     node.with_impl(|node_gradient: &NodeGradient| {
-                       let gradient = node_gradient.get_gradient_with_color_stops_from_node(node);
-                       did_set_gradient =
-                           resolve_fallbacks_and_set_pattern(&gradient, draw_ctx, opacity, &bbox);
-                   });
+        let gradient = node_gradient.get_gradient_with_color_stops_from_node(node);
+        did_set_gradient = resolve_fallbacks_and_set_pattern(&gradient, draw_ctx, opacity, &bbox);
+    });
 
     did_set_gradient
 }
diff --git a/rsvg_internals/src/image.rs b/rsvg_internals/src/image.rs
index b1394008..51b0bccf 100644
--- a/rsvg_internals/src/image.rs
+++ b/rsvg_internals/src/image.rs
@@ -29,12 +29,14 @@ struct NodeImage {
 
 impl NodeImage {
     fn new() -> NodeImage {
-        NodeImage { aspect: Cell::new(AspectRatio::default()),
-                    x: Cell::new(RsvgLength::default()),
-                    y: Cell::new(RsvgLength::default()),
-                    w: Cell::new(RsvgLength::default()),
-                    h: Cell::new(RsvgLength::default()),
-                    surface: RefCell::new(None), }
+        NodeImage {
+            aspect: Cell::new(AspectRatio::default()),
+            x: Cell::new(RsvgLength::default()),
+            y: Cell::new(RsvgLength::default()),
+            w: Cell::new(RsvgLength::default()),
+            h: Cell::new(RsvgLength::default()),
+            surface: RefCell::new(None),
+        }
     }
 }
 
@@ -44,27 +46,33 @@ impl NodeTrait for NodeImage {
             match attr {
                 Attribute::X => self.x.set(parse("x", value, LengthDir::Horizontal, None)?),
                 Attribute::Y => self.y.set(parse("y", value, LengthDir::Vertical, None)?),
-                Attribute::Width => self.w.set(parse("width",
-                                                     value,
-                                                     LengthDir::Horizontal,
-                                                     Some(RsvgLength::check_nonnegative))?),
-                Attribute::Height => self.h.set(parse("height",
-                                                      value,
-                                                      LengthDir::Vertical,
-                                                      Some(RsvgLength::check_nonnegative))?),
+                Attribute::Width => self.w.set(parse(
+                    "width",
+                    value,
+                    LengthDir::Horizontal,
+                    Some(RsvgLength::check_nonnegative),
+                )?),
+                Attribute::Height => self.h.set(parse(
+                    "height",
+                    value,
+                    LengthDir::Vertical,
+                    Some(RsvgLength::check_nonnegative),
+                )?),
 
                 Attribute::PreserveAspectRatio => {
-                    self.aspect.set(parse("preserveAspectRatio", value, (), None)?)
+                    self.aspect
+                        .set(parse("preserveAspectRatio", value, (), None)?)
                 }
 
                 Attribute::XlinkHref | Attribute::Path => {
                     // "path" is used by some older Adobe Illustrator versions
 
                     extern "C" {
-                        fn rsvg_cairo_surface_new_from_href(handle: *const RsvgHandle,
-                                                            href: *const libc::c_char,
-                                                            error: *mut *mut glib_sys::GError)
-                                                            -> *mut cairo_sys::cairo_surface_t;
+                        fn rsvg_cairo_surface_new_from_href(
+                            handle: *const RsvgHandle,
+                            href: *const libc::c_char,
+                            error: *mut *mut glib_sys::GError,
+                        ) -> *mut cairo_sys::cairo_surface_t;
                     }
 
                     let mut error = ptr::null_mut();
@@ -74,8 +82,8 @@ impl NodeTrait for NodeImage {
                     };
                     if !raw_surface.is_null() {
                         *self.surface.borrow_mut() = Some(unsafe {
-                                                              cairo::ImageSurface::from_raw_full 
(raw_surface).unwrap()
-                                                          });
+                            cairo::ImageSurface::from_raw_full(raw_surface).unwrap()
+                        });
                     } else {
                         let _: glib::Error = unsafe { from_glib_full(error) }; // FIXME: we should note that 
the image couldn't be loaded
                     }
@@ -103,19 +111,23 @@ impl NodeTrait for NodeImage {
             let aspect = self.aspect.get();
 
             if !drawing_ctx::state_is_overflow(state) {
-                if let Align::Aligned { fit: FitMode::Slice,
-                                        .. } = aspect.align
+                if let Align::Aligned {
+                    fit: FitMode::Slice,
+                    ..
+                } = aspect.align
                 {
                     drawing_ctx::add_clipping_rect(draw_ctx, x, y, w, h);
                 }
             }
 
-            let (x, y, w, h) = aspect.compute(f64::from(surface.get_width()),
-                                              f64::from(surface.get_height()),
-                                              x,
-                                              y,
-                                              w,
-                                              h);
+            let (x, y, w, h) = aspect.compute(
+                f64::from(surface.get_width()),
+                f64::from(surface.get_height()),
+                x,
+                y,
+                w,
+                h,
+            );
 
             drawing_ctx::render_surface(draw_ctx, surface, x, y, w, h);
 
@@ -129,8 +141,9 @@ impl NodeTrait for NodeImage {
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_image_new(_: *const libc::c_char,
-                                      raw_parent: *const RsvgNode)
-                                      -> *const RsvgNode {
+pub extern "C" fn rsvg_node_image_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
     boxed_node_new(NodeType::Image, raw_parent, Box::new(NodeImage::new()))
 }
diff --git a/rsvg_internals/src/length.rs b/rsvg_internals/src/length.rs
index f47c8cf5..c07b0984 100644
--- a/rsvg_internals/src/length.rs
+++ b/rsvg_internals/src/length.rs
@@ -52,9 +52,11 @@ pub struct RsvgLength {
 
 impl Default for RsvgLength {
     fn default() -> RsvgLength {
-        RsvgLength { length: 0.0,
-                     unit: LengthUnit::Default,
-                     dir: LengthDir::Both, }
+        RsvgLength {
+            length: 0.0,
+            unit: LengthUnit::Default,
+            dir: LengthDir::Both,
+        }
     }
 }
 
@@ -115,8 +117,10 @@ pub extern "C" fn rsvg_length_parse(string: *const libc::c_char, dir: LengthDir)
 // length refers.
 
 fn make_err() -> AttributeError {
-    AttributeError::Parse(ParseError::new("expected length: number(\"em\" | \"ex\" | \"px\" | \
-                                           \"in\" | \"cm\" | \"mm\" | \"pt\" | \"pc\" | \"%\")?"))
+    AttributeError::Parse(ParseError::new(
+        "expected length: number(\"em\" | \"ex\" | \"px\" | \"in\" | \"cm\" | \"mm\" | \"pt\" | \
+         \"pc\" | \"%\")?",
+    ))
 }
 
 impl Parse for RsvgLength {
@@ -137,16 +141,20 @@ impl Parse for RsvgLength {
 
 impl RsvgLength {
     pub fn new(l: f64, unit: LengthUnit, dir: LengthDir) -> RsvgLength {
-        RsvgLength { length: l,
-                     unit,
-                     dir, }
+        RsvgLength {
+            length: l,
+            unit,
+            dir,
+        }
     }
 
     pub fn check_nonnegative(self) -> Result<RsvgLength, AttributeError> {
         if self.length >= 0.0 {
             Ok(self)
         } else {
-            Err(AttributeError::Value("value must be non-negative".to_string()))
+            Err(AttributeError::Value(
+                "value must be non-negative".to_string(),
+            ))
         }
     }
 
@@ -186,11 +194,12 @@ impl RsvgLength {
         }
     }
 
-    pub fn hand_normalize(&self,
-                          pixels_per_inch: f64,
-                          width_or_height: f64,
-                          font_size: f64)
-                          -> f64 {
+    pub fn hand_normalize(
+        &self,
+        pixels_per_inch: f64,
+        width_or_height: f64,
+        font_size: f64,
+    ) -> f64 {
         match self.unit {
             LengthUnit::Default => self.length,
 
@@ -208,54 +217,78 @@ impl RsvgLength {
 
     fn from_cssparser(parser: &mut Parser, dir: LengthDir) -> Result<RsvgLength, AttributeError> {
         let length = {
-            let token = parser.next ()
-                .map_err (|_| AttributeError::Parse (ParseError::new ("expected number and optional symbol, 
or number and percentage")))?;
+            let token = parser.next().map_err(|_| {
+                AttributeError::Parse(ParseError::new(
+                    "expected number and optional symbol, or number and percentage",
+                ))
+            })?;
 
             match *token {
-                Token::Number { value, .. } => RsvgLength { length: f64::from(value),
-                                                            unit: LengthUnit::Default,
-                                                            dir, },
+                Token::Number { value, .. } => RsvgLength {
+                    length: f64::from(value),
+                    unit: LengthUnit::Default,
+                    dir,
+                },
 
-                Token::Percentage { unit_value, .. } => RsvgLength { length:
-                                                                         f64::from(unit_value),
-                                                                     unit: LengthUnit::Percent,
-                                                                     dir, },
+                Token::Percentage { unit_value, .. } => RsvgLength {
+                    length: f64::from(unit_value),
+                    unit: LengthUnit::Percent,
+                    dir,
+                },
 
-                Token::Dimension { value, ref unit, .. } => {
+                Token::Dimension {
+                    value, ref unit, ..
+                } => {
                     let value = f64::from(value);
 
                     match unit.as_ref() {
-                        "em" => RsvgLength { length: value,
-                                             unit: LengthUnit::FontEm,
-                                             dir, },
-
-                        "ex" => RsvgLength { length: value,
-                                             unit: LengthUnit::FontEx,
-                                             dir, },
-
-                        "pt" => RsvgLength { length: value / POINTS_PER_INCH,
-                                             unit: LengthUnit::Inch,
-                                             dir, },
-
-                        "in" => RsvgLength { length: value,
-                                             unit: LengthUnit::Inch,
-                                             dir, },
-
-                        "cm" => RsvgLength { length: value / CM_PER_INCH,
-                                             unit: LengthUnit::Inch,
-                                             dir, },
-
-                        "mm" => RsvgLength { length: value / MM_PER_INCH,
-                                             unit: LengthUnit::Inch,
-                                             dir, },
-
-                        "pc" => RsvgLength { length: value / PICA_PER_INCH,
-                                             unit: LengthUnit::Inch,
-                                             dir, },
-
-                        "px" => RsvgLength { length: value,
-                                             unit: LengthUnit::Default,
-                                             dir, },
+                        "em" => RsvgLength {
+                            length: value,
+                            unit: LengthUnit::FontEm,
+                            dir,
+                        },
+
+                        "ex" => RsvgLength {
+                            length: value,
+                            unit: LengthUnit::FontEx,
+                            dir,
+                        },
+
+                        "pt" => RsvgLength {
+                            length: value / POINTS_PER_INCH,
+                            unit: LengthUnit::Inch,
+                            dir,
+                        },
+
+                        "in" => RsvgLength {
+                            length: value,
+                            unit: LengthUnit::Inch,
+                            dir,
+                        },
+
+                        "cm" => RsvgLength {
+                            length: value / CM_PER_INCH,
+                            unit: LengthUnit::Inch,
+                            dir,
+                        },
+
+                        "mm" => RsvgLength {
+                            length: value / MM_PER_INCH,
+                            unit: LengthUnit::Inch,
+                            dir,
+                        },
+
+                        "pc" => RsvgLength {
+                            length: value / PICA_PER_INCH,
+                            unit: LengthUnit::Inch,
+                            dir,
+                        },
+
+                        "px" => RsvgLength {
+                            length: value,
+                            unit: LengthUnit::Default,
+                            dir,
+                        },
 
                         _ => return Err(make_err()),
                     }
@@ -263,18 +296,24 @@ impl RsvgLength {
 
                 // FIXME: why are the following in Length?  They should be in FontSize
                 Token::Ident(ref cow) => match cow.as_ref() {
-                    "larger" => RsvgLength { length: 0.0,
-                                             unit: LengthUnit::RelativeLarger,
-                                             dir, },
-
-                    "smaller" => RsvgLength { length: 0.0,
-                                              unit: LengthUnit::RelativeSmaller,
-                                              dir, },
+                    "larger" => RsvgLength {
+                        length: 0.0,
+                        unit: LengthUnit::RelativeLarger,
+                        dir,
+                    },
+
+                    "smaller" => RsvgLength {
+                        length: 0.0,
+                        unit: LengthUnit::RelativeSmaller,
+                        dir,
+                    },
 
                     "xx-small" | "x-small" | "small" | "medium" | "large" | "x-large"
-                    | "xx-large" => RsvgLength { length: compute_named_size(cow),
-                                                 unit: LengthUnit::Inch,
-                                                 dir, },
+                    | "xx-large" => RsvgLength {
+                        length: compute_named_size(cow),
+                        unit: LengthUnit::Inch,
+                        dir,
+                    },
 
                     _ => return Err(make_err()),
                 },
@@ -351,7 +390,9 @@ fn parse_dash_array(s: &str) -> Result<Vec<RsvgLength>, AttributeError> {
 
     // Commas must be followed by a value.
     if COMMAS.is_match(s) {
-        return Err(AttributeError::Parse(ParseError::new("expected number, found comma")));
+        return Err(AttributeError::Parse(ParseError::new(
+            "expected number, found comma",
+        )));
     }
 
     // Values can be comma or whitespace separated.
@@ -367,9 +408,10 @@ fn parse_dash_array(s: &str) -> Result<Vec<RsvgLength>, AttributeError> {
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_length_normalize(raw_length: *const RsvgLength,
-                                        draw_ctx: *const RsvgDrawingCtx)
-                                        -> f64 {
+pub extern "C" fn rsvg_length_normalize(
+    raw_length: *const RsvgLength,
+    draw_ctx: *const RsvgDrawingCtx,
+) -> f64 {
     assert!(!raw_length.is_null());
 
     let length: &RsvgLength = unsafe { &*raw_length };
@@ -378,11 +420,12 @@ pub extern "C" fn rsvg_length_normalize(raw_length: *const RsvgLength,
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_length_hand_normalize(raw_length: *const RsvgLength,
-                                             pixels_per_inch: f64,
-                                             width_or_height: f64,
-                                             font_size: f64)
-                                             -> f64 {
+pub extern "C" fn rsvg_length_hand_normalize(
+    raw_length: *const RsvgLength,
+    pixels_per_inch: f64,
+    width_or_height: f64,
+    font_size: f64,
+) -> f64 {
     assert!(!raw_length.is_null());
 
     let length: &RsvgLength = unsafe { &*raw_length };
@@ -395,24 +438,29 @@ pub extern "C" fn rsvg_parse_stroke_dasharray(string: *const libc::c_char) -> Rs
     let my_string = unsafe { &String::from_glib_none(string) };
 
     match parse_stroke_dash_array(my_string) {
-        Ok(StrokeDasharray::None) => RsvgStrokeDasharray { kind: RsvgStrokeDasharrayKind::None,
-                                                           num_dashes: 0,
-                                                           dashes: ptr::null_mut(), },
-
-        Ok(StrokeDasharray::Inherit) => RsvgStrokeDasharray { kind:
-                                                                  RsvgStrokeDasharrayKind::Inherit,
-                                                              num_dashes: 0,
-                                                              dashes: ptr::null_mut(), },
-
-        Ok(StrokeDasharray::Dasharray(ref v)) => {
-            RsvgStrokeDasharray { kind: RsvgStrokeDasharrayKind::Dashes,
-                                  num_dashes: v.len(),
-                                  dashes: to_c_array(v), }
-        }
-
-        Err(_) => RsvgStrokeDasharray { kind: RsvgStrokeDasharrayKind::Error,
-                                        num_dashes: 0,
-                                        dashes: ptr::null_mut(), },
+        Ok(StrokeDasharray::None) => RsvgStrokeDasharray {
+            kind: RsvgStrokeDasharrayKind::None,
+            num_dashes: 0,
+            dashes: ptr::null_mut(),
+        },
+
+        Ok(StrokeDasharray::Inherit) => RsvgStrokeDasharray {
+            kind: RsvgStrokeDasharrayKind::Inherit,
+            num_dashes: 0,
+            dashes: ptr::null_mut(),
+        },
+
+        Ok(StrokeDasharray::Dasharray(ref v)) => RsvgStrokeDasharray {
+            kind: RsvgStrokeDasharrayKind::Dashes,
+            num_dashes: v.len(),
+            dashes: to_c_array(v),
+        },
+
+        Err(_) => RsvgStrokeDasharray {
+            kind: RsvgStrokeDasharrayKind::Error,
+            num_dashes: 0,
+            dashes: ptr::null_mut(),
+        },
     }
 }
 
@@ -430,78 +478,118 @@ mod tests {
 
     #[test]
     fn parses_default() {
-        assert_eq!(RsvgLength::parse("42", LengthDir::Horizontal),
-                   Ok(RsvgLength::new(42.0,
-                                      LengthUnit::Default,
-                                      LengthDir::Horizontal)));
-
-        assert_eq!(RsvgLength::parse("-42px", LengthDir::Horizontal),
-                   Ok(RsvgLength::new(-42.0,
-                                      LengthUnit::Default,
-                                      LengthDir::Horizontal)));
+        assert_eq!(
+            RsvgLength::parse("42", LengthDir::Horizontal),
+            Ok(RsvgLength::new(
+                42.0,
+                LengthUnit::Default,
+                LengthDir::Horizontal
+            ))
+        );
+
+        assert_eq!(
+            RsvgLength::parse("-42px", LengthDir::Horizontal),
+            Ok(RsvgLength::new(
+                -42.0,
+                LengthUnit::Default,
+                LengthDir::Horizontal
+            ))
+        );
     }
 
     #[test]
     fn parses_percent() {
-        assert_eq!(RsvgLength::parse("50.0%", LengthDir::Horizontal),
-                   Ok(RsvgLength::new(0.5,
-                                      LengthUnit::Percent,
-                                      LengthDir::Horizontal)));
+        assert_eq!(
+            RsvgLength::parse("50.0%", LengthDir::Horizontal),
+            Ok(RsvgLength::new(
+                0.5,
+                LengthUnit::Percent,
+                LengthDir::Horizontal
+            ))
+        );
     }
 
     #[test]
     fn parses_font_em() {
-        assert_eq!(RsvgLength::parse("22.5em", LengthDir::Vertical),
-                   Ok(RsvgLength::new(22.5,
-                                      LengthUnit::FontEm,
-                                      LengthDir::Vertical)));
+        assert_eq!(
+            RsvgLength::parse("22.5em", LengthDir::Vertical),
+            Ok(RsvgLength::new(
+                22.5,
+                LengthUnit::FontEm,
+                LengthDir::Vertical
+            ))
+        );
     }
 
     #[test]
     fn parses_font_ex() {
-        assert_eq!(RsvgLength::parse("22.5ex", LengthDir::Vertical),
-                   Ok(RsvgLength::new(22.5,
-                                      LengthUnit::FontEx,
-                                      LengthDir::Vertical)));
+        assert_eq!(
+            RsvgLength::parse("22.5ex", LengthDir::Vertical),
+            Ok(RsvgLength::new(
+                22.5,
+                LengthUnit::FontEx,
+                LengthDir::Vertical
+            ))
+        );
     }
 
     #[test]
     fn parses_physical_units() {
-        assert_eq!(RsvgLength::parse("72pt", LengthDir::Both),
-                   Ok(RsvgLength::new(1.0, LengthUnit::Inch, LengthDir::Both)));
-
-        assert_eq!(RsvgLength::parse("-22.5in", LengthDir::Both),
-                   Ok(RsvgLength::new(-22.5, LengthUnit::Inch, LengthDir::Both)));
-
-        assert_eq!(RsvgLength::parse("-254cm", LengthDir::Both),
-                   Ok(RsvgLength::new(-100.0, LengthUnit::Inch, LengthDir::Both)));
-
-        assert_eq!(RsvgLength::parse("254mm", LengthDir::Both),
-                   Ok(RsvgLength::new(10.0, LengthUnit::Inch, LengthDir::Both)));
-
-        assert_eq!(RsvgLength::parse("60pc", LengthDir::Both),
-                   Ok(RsvgLength::new(10.0, LengthUnit::Inch, LengthDir::Both)));
+        assert_eq!(
+            RsvgLength::parse("72pt", LengthDir::Both),
+            Ok(RsvgLength::new(1.0, LengthUnit::Inch, LengthDir::Both))
+        );
+
+        assert_eq!(
+            RsvgLength::parse("-22.5in", LengthDir::Both),
+            Ok(RsvgLength::new(-22.5, LengthUnit::Inch, LengthDir::Both))
+        );
+
+        assert_eq!(
+            RsvgLength::parse("-254cm", LengthDir::Both),
+            Ok(RsvgLength::new(-100.0, LengthUnit::Inch, LengthDir::Both))
+        );
+
+        assert_eq!(
+            RsvgLength::parse("254mm", LengthDir::Both),
+            Ok(RsvgLength::new(10.0, LengthUnit::Inch, LengthDir::Both))
+        );
+
+        assert_eq!(
+            RsvgLength::parse("60pc", LengthDir::Both),
+            Ok(RsvgLength::new(10.0, LengthUnit::Inch, LengthDir::Both))
+        );
     }
 
     #[test]
     fn parses_relative_larger() {
-        assert_eq!(RsvgLength::parse("larger", LengthDir::Vertical),
-                   Ok(RsvgLength::new(0.0,
-                                      LengthUnit::RelativeLarger,
-                                      LengthDir::Vertical)));
+        assert_eq!(
+            RsvgLength::parse("larger", LengthDir::Vertical),
+            Ok(RsvgLength::new(
+                0.0,
+                LengthUnit::RelativeLarger,
+                LengthDir::Vertical
+            ))
+        );
     }
 
     #[test]
     fn parses_relative_smaller() {
-        assert_eq!(RsvgLength::parse("smaller", LengthDir::Vertical),
-                   Ok(RsvgLength::new(0.0,
-                                      LengthUnit::RelativeSmaller,
-                                      LengthDir::Vertical)));
+        assert_eq!(
+            RsvgLength::parse("smaller", LengthDir::Vertical),
+            Ok(RsvgLength::new(
+                0.0,
+                LengthUnit::RelativeSmaller,
+                LengthDir::Vertical
+            ))
+        );
     }
 
     #[test]
     fn parses_named_sizes() {
-        let names = vec!["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large"];
+        let names = vec![
+            "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large"
+        ];
 
         let mut previous_value: Option<f64> = None;
 
@@ -529,7 +617,10 @@ mod tests {
 
     #[test]
     fn invalid_unit_yields_error() {
-        assert!(is_parse_error(&RsvgLength::parse("8furlong", LengthDir::Both)));
+        assert!(is_parse_error(&RsvgLength::parse(
+            "8furlong",
+            LengthDir::Both
+        )));
     }
 
     #[test]
@@ -537,25 +628,40 @@ mod tests {
         // FIXME: this is intended to test the (absence of) the "larger" et al values.
         // Since they really be in FontSize, not RsvgLength, we should remember
         // to move this test to that type later.
-        assert!(is_parse_error(&RsvgLength::parse("furlong", LengthDir::Both)));
+        assert!(is_parse_error(&RsvgLength::parse(
+            "furlong",
+            LengthDir::Both
+        )));
     }
 
     #[test]
     fn check_nonnegative_works() {
-        assert!(RsvgLength::parse("0", LengthDir::Both).and_then(|l| l.check_nonnegative())
-                                                       .is_ok());
-        assert!(RsvgLength::parse("-10", LengthDir::Both).and_then(|l| l.check_nonnegative())
-                                                         .is_err());
+        assert!(
+            RsvgLength::parse("0", LengthDir::Both)
+                .and_then(|l| l.check_nonnegative())
+                .is_ok()
+        );
+        assert!(
+            RsvgLength::parse("-10", LengthDir::Both)
+                .and_then(|l| l.check_nonnegative())
+                .is_err()
+        );
     }
 
     #[test]
     fn parses_stroke_dasharray() {
-        assert_eq!(parse_stroke_dash_array("none").unwrap(),
-                   StrokeDasharray::None);
-        assert_eq!(parse_stroke_dash_array("inherit").unwrap(),
-                   StrokeDasharray::Inherit);
-        assert_eq!(parse_stroke_dash_array("10, 5").unwrap(),
-                   StrokeDasharray::Dasharray(parse_dash_array("10, 5").unwrap()));
+        assert_eq!(
+            parse_stroke_dash_array("none").unwrap(),
+            StrokeDasharray::None
+        );
+        assert_eq!(
+            parse_stroke_dash_array("inherit").unwrap(),
+            StrokeDasharray::Inherit
+        );
+        assert_eq!(
+            parse_stroke_dash_array("10, 5").unwrap(),
+            StrokeDasharray::Dasharray(parse_dash_array("10, 5").unwrap())
+        );
         assert!(parse_stroke_dash_array("").is_err());
     }
 
@@ -564,22 +670,28 @@ mod tests {
         // helper to cut down boilderplate
         let length_parse = |s| RsvgLength::parse(s, LengthDir::Both).unwrap();
 
-        let expected = vec![length_parse("1"),
-                            length_parse("2in"),
-                            length_parse("3"),
-                            length_parse("4%")];
+        let expected = vec![
+            length_parse("1"),
+            length_parse("2in"),
+            length_parse("3"),
+            length_parse("4%"),
+        ];
 
         let sample_1 = vec![length_parse("10"), length_parse("6")];
         let sample_2 = vec![length_parse("5"), length_parse("5"), length_parse("20")];
 
-        let sample_3 = vec![length_parse("10px"),
-                            length_parse("20px"),
-                            length_parse("20px")];
+        let sample_3 = vec![
+            length_parse("10px"),
+            length_parse("20px"),
+            length_parse("20px"),
+        ];
 
-        let sample_4 = vec![length_parse("25"),
-                            length_parse("5"),
-                            length_parse("5"),
-                            length_parse("5")];
+        let sample_4 = vec![
+            length_parse("25"),
+            length_parse("5"),
+            length_parse("5"),
+            length_parse("5"),
+        ];
 
         let sample_5 = vec![length_parse("3.1415926"), length_parse("8")];
         let sample_6 = vec![length_parse("5"), length_parse("3.14")];
@@ -595,10 +707,14 @@ mod tests {
         assert_eq!(parse_dash_array("2").unwrap(), sample_7);
 
         // Empty dash_array
-        assert_eq!(parse_dash_array(""),
-                   Err(AttributeError::Parse(ParseError::new("empty string"))));
-        assert_eq!(parse_dash_array("\t  \n     "),
-                   Err(AttributeError::Parse(ParseError::new("empty string"))));
+        assert_eq!(
+            parse_dash_array(""),
+            Err(AttributeError::Parse(ParseError::new("empty string")))
+        );
+        assert_eq!(
+            parse_dash_array("\t  \n     "),
+            Err(AttributeError::Parse(ParseError::new("empty string")))
+        );
         assert!(parse_dash_array(",,,").is_err());
         assert!(parse_dash_array("10,  \t, 20 \n").is_err());
         // No trailling commas allowed, parse error
diff --git a/rsvg_internals/src/link.rs b/rsvg_internals/src/link.rs
index af44df97..63f9de46 100644
--- a/rsvg_internals/src/link.rs
+++ b/rsvg_internals/src/link.rs
@@ -19,7 +19,9 @@ struct NodeLink {
 
 impl NodeLink {
     fn new() -> NodeLink {
-        NodeLink { link: RefCell::new(None), }
+        NodeLink {
+            link: RefCell::new(None),
+        }
     }
 }
 
@@ -44,13 +46,11 @@ impl NodeTrait for NodeLink {
 
             let attributes = link.as_ref().map(|i| format!("uri='{}'", escape_value(i)));
 
-            drawing_ctx::get_cairo_context(draw_ctx).with_tag(CAIRO_TAG_LINK,
-                                                              attributes.as_ref()
-                                                                        .map(|i| i.as_str()),
-                                                              || {
-                                                                  node.draw_children(draw_ctx,
-                                                                                     dominate)
-                                                              })
+            drawing_ctx::get_cairo_context(draw_ctx).with_tag(
+                CAIRO_TAG_LINK,
+                attributes.as_ref().map(|i| i.as_str()),
+                || node.draw_children(draw_ctx, dominate),
+            )
         } else {
             node.draw_children(draw_ctx, dominate)
         }
@@ -77,9 +77,11 @@ fn escape_value(value: &str) -> Cow<str> {
 }
 
 extern "C" {
-    fn cairo_tag_begin(cr: *mut cairo_sys::cairo_t,
-                       tag_name: *const libc::c_char,
-                       attibutes: *const libc::c_char);
+    fn cairo_tag_begin(
+        cr: *mut cairo_sys::cairo_t,
+        tag_name: *const libc::c_char,
+        attibutes: *const libc::c_char,
+    );
     fn cairo_tag_end(cr: *mut cairo_sys::cairo_t, tag_name: *const libc::c_char);
 }
 
@@ -88,7 +90,8 @@ trait CairoTagging {
     fn tag_begin(&self, tag_name: &str, attributes: Option<&str>);
     fn tag_end(&self, tag_name: &str);
     fn with_tag<U, T>(&self, tag_name: &str, attributes: Option<&str>, f: U) -> T
-        where U: Fn() -> T
+    where
+        U: Fn() -> T,
     {
         self.tag_begin(tag_name, attributes);
         let result = f();
@@ -101,9 +104,11 @@ trait CairoTagging {
 impl CairoTagging for cairo::Context {
     fn tag_begin(&self, tag_name: &str, attributes: Option<&str>) {
         unsafe {
-            cairo_tag_begin(self.to_glib_none().0,
-                            tag_name.to_glib_none().0,
-                            attributes.to_glib_none().0);
+            cairo_tag_begin(
+                self.to_glib_none().0,
+                tag_name.to_glib_none().0,
+                attributes.to_glib_none().0,
+            );
         }
     }
 
@@ -116,8 +121,9 @@ impl CairoTagging for cairo::Context {
 
 // ****************** C Prototypes  ******************
 #[no_mangle]
-pub extern "C" fn rsvg_node_link_new(_: *const libc::c_char,
-                                     raw_parent: *const RsvgNode)
-                                     -> *const RsvgNode {
+pub extern "C" fn rsvg_node_link_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
     boxed_node_new(NodeType::Link, raw_parent, Box::new(NodeLink::new()))
 }
diff --git a/rsvg_internals/src/marker.rs b/rsvg_internals/src/marker.rs
index 0e80ed69..e287ee0c 100644
--- a/rsvg_internals/src/marker.rs
+++ b/rsvg_internals/src/marker.rs
@@ -42,8 +42,9 @@ impl Parse for MarkerUnits {
         match s {
             "userSpaceOnUse" => Ok(MarkerUnits::UserSpaceOnUse),
             "strokeWidth" => Ok(MarkerUnits::StrokeWidth),
-            _ => Err(AttributeError::Parse(ParseError::new("expected \"userSpaceOnUse\" or \
-                                                            \"strokeWidth\""))),
+            _ => Err(AttributeError::Parse(ParseError::new(
+                "expected \"userSpaceOnUse\" or \"strokeWidth\"",
+            ))),
         }
     }
 }
@@ -68,8 +69,9 @@ impl Parse for MarkerOrient {
     fn parse(s: &str, _: ()) -> Result<MarkerOrient, AttributeError> {
         match s {
             "auto" => Ok(MarkerOrient::Auto),
-            _ => parsers::angle_degrees(s).map(MarkerOrient::Degrees)
-                                          .map_err(AttributeError::Parse),
+            _ => parsers::angle_degrees(s)
+                .map(MarkerOrient::Degrees)
+                .map_err(AttributeError::Parse),
         }
     }
 }
@@ -88,14 +90,16 @@ struct NodeMarker {
 
 impl NodeMarker {
     fn new() -> NodeMarker {
-        NodeMarker { units: Cell::new(MarkerUnits::default()),
-                     ref_x: Cell::new(RsvgLength::default()),
-                     ref_y: Cell::new(RsvgLength::default()),
-                     width: Cell::new(NodeMarker::get_default_size(LengthDir::Horizontal)),
-                     height: Cell::new(NodeMarker::get_default_size(LengthDir::Vertical)),
-                     orient: Cell::new(MarkerOrient::default()),
-                     aspect: Cell::new(AspectRatio::default()),
-                     vbox: Cell::new(None), }
+        NodeMarker {
+            units: Cell::new(MarkerUnits::default()),
+            ref_x: Cell::new(RsvgLength::default()),
+            ref_y: Cell::new(RsvgLength::default()),
+            width: Cell::new(NodeMarker::get_default_size(LengthDir::Horizontal)),
+            height: Cell::new(NodeMarker::get_default_size(LengthDir::Vertical)),
+            orient: Cell::new(MarkerOrient::default()),
+            aspect: Cell::new(AspectRatio::default()),
+            vbox: Cell::new(None),
+        }
     }
 
     fn get_default_size(dir: LengthDir) -> RsvgLength {
@@ -103,14 +107,16 @@ impl NodeMarker {
         RsvgLength::parse("3", dir).unwrap()
     }
 
-    fn render(&self,
-              node: &RsvgNode,
-              c_node: *const RsvgNode,
-              draw_ctx: *const RsvgDrawingCtx,
-              xpos: f64,
-              ypos: f64,
-              computed_angle: f64,
-              line_width: f64) {
+    fn render(
+        &self,
+        node: &RsvgNode,
+        c_node: *const RsvgNode,
+        draw_ctx: *const RsvgDrawingCtx,
+        xpos: f64,
+        ypos: f64,
+        computed_angle: f64,
+        line_width: f64,
+    ) {
         let marker_width = self.width.get().normalize(draw_ctx);
         let marker_height = self.height.get().normalize(draw_ctx);
 
@@ -134,12 +140,14 @@ impl NodeMarker {
         }
 
         if let Some(vbox) = self.vbox.get() {
-            let (_, _, w, h) = self.aspect.get().compute(vbox.0.width,
-                                                         vbox.0.height,
-                                                         0.0,
-                                                         0.0,
-                                                         marker_width,
-                                                         marker_height);
+            let (_, _, w, h) = self.aspect.get().compute(
+                vbox.0.width,
+                vbox.0.height,
+                0.0,
+                0.0,
+                marker_width,
+                marker_height,
+            );
 
             affine.scale(w / vbox.0.width, h / vbox.0.height);
 
@@ -150,8 +158,10 @@ impl NodeMarker {
             drawing_ctx::push_discrete_layer(draw_ctx);
         }
 
-        affine.translate(-self.ref_x.get().normalize(draw_ctx),
-                         -self.ref_y.get().normalize(draw_ctx));
+        affine.translate(
+            -self.ref_x.get().normalize(draw_ctx),
+            -self.ref_y.get().normalize(draw_ctx),
+        );
 
         drawing_ctx::state_push(draw_ctx);
 
@@ -165,11 +175,13 @@ impl NodeMarker {
 
         if !drawing_ctx::state_is_overflow(state) {
             if let Some(vbox) = self.vbox.get() {
-                drawing_ctx::add_clipping_rect(draw_ctx,
-                                               vbox.0.x,
-                                               vbox.0.y,
-                                               vbox.0.width,
-                                               vbox.0.height);
+                drawing_ctx::add_clipping_rect(
+                    draw_ctx,
+                    vbox.0.x,
+                    vbox.0.y,
+                    vbox.0.width,
+                    vbox.0.height,
+                );
             } else {
                 drawing_ctx::add_clipping_rect(draw_ctx, 0.0, 0.0, marker_width, marker_height);
             }
@@ -190,25 +202,32 @@ impl NodeTrait for NodeMarker {
                 Attribute::MarkerUnits => self.units.set(parse("markerUnits", value, (), None)?),
 
                 Attribute::RefX => {
-                    self.ref_x.set(parse("refX", value, LengthDir::Horizontal, None)?)
+                    self.ref_x
+                        .set(parse("refX", value, LengthDir::Horizontal, None)?)
                 }
 
-                Attribute::RefY => self.ref_y.set(parse("refY", value, LengthDir::Vertical, None)?),
+                Attribute::RefY => self.ref_y
+                    .set(parse("refY", value, LengthDir::Vertical, None)?),
 
-                Attribute::MarkerWidth => self.width.set(parse("markerWidth",
-                                                         value,
-                                                         LengthDir::Horizontal,
-                                                         Some(RsvgLength::check_nonnegative))?),
+                Attribute::MarkerWidth => self.width.set(parse(
+                    "markerWidth",
+                    value,
+                    LengthDir::Horizontal,
+                    Some(RsvgLength::check_nonnegative),
+                )?),
 
-                Attribute::MarkerHeight => self.height.set(parse("markerHeight",
-                                                          value,
-                                                          LengthDir::Vertical,
-                                                          Some(RsvgLength::check_nonnegative))?),
+                Attribute::MarkerHeight => self.height.set(parse(
+                    "markerHeight",
+                    value,
+                    LengthDir::Vertical,
+                    Some(RsvgLength::check_nonnegative),
+                )?),
 
                 Attribute::Orient => self.orient.set(parse("orient", value, (), None)?),
 
                 Attribute::PreserveAspectRatio => {
-                    self.aspect.set(parse("preserveAspectRatio", value, (), None)?)
+                    self.aspect
+                        .set(parse("preserveAspectRatio", value, (), None)?)
                 }
 
                 Attribute::ViewBox => self.vbox.set(Some(parse("viewBox", value, (), None)?)),
@@ -230,9 +249,10 @@ impl NodeTrait for NodeMarker {
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_marker_new(_: *const libc::c_char,
-                                       raw_parent: *const RsvgNode)
-                                       -> *const RsvgNode {
+pub extern "C" fn rsvg_node_marker_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
     boxed_node_new(NodeType::Marker, raw_parent, Box::new(NodeMarker::new()))
 }
 
@@ -284,14 +304,16 @@ fn make_degenerate(x: f64, y: f64) -> Segment {
 }
 
 fn make_curve(x1: f64, y1: f64, x2: f64, y2: f64, x3: f64, y3: f64, x4: f64, y4: f64) -> Segment {
-    Segment::LineOrCurve { x1,
-                           y1,
-                           x2,
-                           y2,
-                           x3,
-                           y3,
-                           x4,
-                           y4, }
+    Segment::LineOrCurve {
+        x1,
+        y1,
+        x2,
+        y2,
+        x3,
+        y3,
+        x4,
+        y4,
+    }
 }
 
 fn make_line(x1: f64, y1: f64, x2: f64, y2: f64) -> Segment {
@@ -409,14 +431,16 @@ fn get_segment_directionalities(segment: &Segment) -> Option<(f64, f64, f64, f64
     match *segment {
         Segment::Degenerate { .. } => None,
 
-        Segment::LineOrCurve { x1,
-                               y1,
-                               x2,
-                               y2,
-                               x3,
-                               y3,
-                               x4,
-                               y4, } => {
+        Segment::LineOrCurve {
+            x1,
+            y1,
+            x2,
+            y2,
+            x3,
+            y3,
+            x4,
+            y4,
+        } => {
             let coincide_1_and_2 = points_equal(x1, y1, x2, y2);
             let coincide_1_and_3 = points_equal(x1, y1, x3, y3);
             let coincide_1_and_4 = points_equal(x1, y1, x4, y4);
@@ -467,9 +491,10 @@ fn get_segment_directionalities(segment: &Segment) -> Option<(f64, f64, f64, f64
 // directionality. Otherwise, set the directionality for the path
 // segment's start and end points to align with the positive x-axis
 // in user space.
-fn find_incoming_directionality_backwards(segments: &[Segment],
-                                          start_index: usize)
-                                          -> (bool, f64, f64) {
+fn find_incoming_directionality_backwards(
+    segments: &[Segment],
+    start_index: usize,
+) -> (bool, f64, f64) {
     // "go backwards ... within the current subpath until ... segment which has directionality
     // at its end point"
     for segment in segments[..start_index + 1].iter().rev() {
@@ -478,25 +503,24 @@ fn find_incoming_directionality_backwards(segments: &[Segment],
                 return (false, 0.0, 0.0); // reached the beginning of the subpath as we ran into a 
standalone point
             }
 
-            Segment::LineOrCurve { .. } => {
-                match get_segment_directionalities(segment) {
-                    Some((_, _, v2x, v2y)) => {
-                        return (true, v2x, v2y);
-                    }
-                    None => {
-                        continue;
-                    }
+            Segment::LineOrCurve { .. } => match get_segment_directionalities(segment) {
+                Some((_, _, v2x, v2y)) => {
+                    return (true, v2x, v2y);
                 }
-            }
+                None => {
+                    continue;
+                }
+            },
         }
     }
 
     (false, 0.0, 0.0)
 }
 
-fn find_outgoing_directionality_forwards(segments: &[Segment],
-                                         start_index: usize)
-                                         -> (bool, f64, f64) {
+fn find_outgoing_directionality_forwards(
+    segments: &[Segment],
+    start_index: usize,
+) -> (bool, f64, f64) {
     // "go forwards ... within the current subpath until ... segment which has directionality at
     // its start point"
     for segment in &segments[start_index..] {
@@ -505,16 +529,14 @@ fn find_outgoing_directionality_forwards(segments: &[Segment],
                 return (false, 0.0, 0.0); // reached the end of a subpath as we ran into a standalone point
             }
 
-            Segment::LineOrCurve { .. } => {
-                match get_segment_directionalities(segment) {
-                    Some((v1x, v1y, _, _)) => {
-                        return (true, v1x, v1y);
-                    }
-                    None => {
-                        continue;
-                    }
+            Segment::LineOrCurve { .. } => match get_segment_directionalities(segment) {
+                Some((v1x, v1y, _, _)) => {
+                    return (true, v1x, v1y);
                 }
-            }
+                None => {
+                    continue;
+                }
+            },
         }
     }
 
@@ -566,12 +588,14 @@ enum MarkerType {
     End,
 }
 
-fn emit_marker_by_name(draw_ctx: *const RsvgDrawingCtx,
-                       marker_name: *const libc::c_char,
-                       xpos: f64,
-                       ypos: f64,
-                       computed_angle: f64,
-                       line_width: f64) {
+fn emit_marker_by_name(
+    draw_ctx: *const RsvgDrawingCtx,
+    marker_name: *const libc::c_char,
+    xpos: f64,
+    ypos: f64,
+    computed_angle: f64,
+    line_width: f64,
+) {
     if marker_name.is_null() {
         return;
     }
@@ -587,21 +611,24 @@ fn emit_marker_by_name(draw_ctx: *const RsvgDrawingCtx,
     let node: &RsvgNode = unsafe { &*c_node };
 
     node.with_impl(|marker: &NodeMarker| {
-                       marker.render(node,
-                                     c_node,
-                                     draw_ctx,
-                                     xpos,
-                                     ypos,
-                                     computed_angle,
-                                     line_width)
-                   });
+        marker.render(
+            node,
+            c_node,
+            draw_ctx,
+            xpos,
+            ypos,
+            computed_angle,
+            line_width,
+        )
+    });
 
     drawing_ctx::release_node(draw_ctx, c_node);
 }
 
-fn get_marker_name_from_drawing_ctx(draw_ctx: *const RsvgDrawingCtx,
-                                    marker_type: MarkerType)
-                                    -> *const libc::c_char {
+fn get_marker_name_from_drawing_ctx(
+    draw_ctx: *const RsvgDrawingCtx,
+    marker_type: MarkerType,
+) -> *const libc::c_char {
     match marker_type {
         MarkerType::Start => unsafe { rsvg_get_start_marker(draw_ctx) },
         MarkerType::Middle => unsafe { rsvg_get_middle_marker(draw_ctx) },
@@ -615,12 +642,14 @@ enum MarkerEndpoint {
     End,
 }
 
-fn emit_marker<E>(segment: &Segment,
-                  endpoint: MarkerEndpoint,
-                  marker_type: MarkerType,
-                  orient: f64,
-                  emit_fn: &mut E)
-    where E: FnMut(MarkerType, f64, f64, f64)
+fn emit_marker<E>(
+    segment: &Segment,
+    endpoint: MarkerEndpoint,
+    marker_type: MarkerType,
+    orient: f64,
+    emit_fn: &mut E,
+) where
+    E: FnMut(MarkerType, f64, f64, f64),
 {
     let (x, y) = match *segment {
         Segment::Degenerate { x, y } => (x, y),
@@ -644,8 +673,8 @@ extern "C" {
 
 fn drawing_ctx_has_markers(draw_ctx: *const RsvgDrawingCtx) -> bool {
     (!get_marker_name_from_drawing_ctx(draw_ctx, MarkerType::Start).is_null()
-     || !get_marker_name_from_drawing_ctx(draw_ctx, MarkerType::Middle).is_null()
-     || !get_marker_name_from_drawing_ctx(draw_ctx, MarkerType::End).is_null())
+        || !get_marker_name_from_drawing_ctx(draw_ctx, MarkerType::Middle).is_null()
+        || !get_marker_name_from_drawing_ctx(draw_ctx, MarkerType::End).is_null())
 }
 
 pub fn render_markers_for_path_builder(builder: &RsvgPathBuilder, draw_ctx: *const RsvgDrawingCtx) {
@@ -659,19 +688,24 @@ pub fn render_markers_for_path_builder(builder: &RsvgPathBuilder, draw_ctx: *con
         return;
     }
 
-    emit_markers_for_path_builder (builder,
-                                   &mut |marker_type: MarkerType, x: f64, y: f64, computed_angle: f64| {
-                                       emit_marker_by_name (draw_ctx,
-                                                            get_marker_name_from_drawing_ctx (draw_ctx, 
marker_type),
-                                                            x,
-                                                            y,
-                                                            computed_angle,
-                                                            linewidth);
-                                   });
+    emit_markers_for_path_builder(
+        builder,
+        &mut |marker_type: MarkerType, x: f64, y: f64, computed_angle: f64| {
+            emit_marker_by_name(
+                draw_ctx,
+                get_marker_name_from_drawing_ctx(draw_ctx, marker_type),
+                x,
+                y,
+                computed_angle,
+                linewidth,
+            );
+        },
+    );
 }
 
 fn emit_markers_for_path_builder<E>(builder: &RsvgPathBuilder, emit_fn: &mut E)
-    where E: FnMut(MarkerType, f64, f64, f64)
+where
+    E: FnMut(MarkerType, f64, f64, f64),
 {
     enum SubpathState {
         NoSubpath,
@@ -692,19 +726,23 @@ fn emit_markers_for_path_builder<E>(builder: &RsvgPathBuilder, emit_fn: &mut E)
                     // Got a lone point after a subpath; render the subpath's end marker first
                     let (_, incoming_vx, incoming_vy) =
                         find_incoming_directionality_backwards(&segments, i - 1);
-                    emit_marker(&segments[i - 1],
-                                MarkerEndpoint::End,
-                                MarkerType::End,
-                                angle_from_vector(incoming_vx, incoming_vy),
-                                emit_fn);
+                    emit_marker(
+                        &segments[i - 1],
+                        MarkerEndpoint::End,
+                        MarkerType::End,
+                        angle_from_vector(incoming_vx, incoming_vy),
+                        emit_fn,
+                    );
                 }
 
                 // Render marker for the lone point; no directionality
-                emit_marker(segment,
-                            MarkerEndpoint::Start,
-                            MarkerType::Middle,
-                            0.0,
-                            emit_fn);
+                emit_marker(
+                    segment,
+                    MarkerEndpoint::Start,
+                    MarkerType::Middle,
+                    0.0,
+                    emit_fn,
+                );
 
                 subpath_state = SubpathState::NoSubpath;
             }
@@ -715,11 +753,13 @@ fn emit_markers_for_path_builder<E>(builder: &RsvgPathBuilder, emit_fn: &mut E)
                     SubpathState::NoSubpath => {
                         let (_, outgoing_vx, outgoing_vy) =
                             find_outgoing_directionality_forwards(&segments, i);
-                        emit_marker(segment,
-                                    MarkerEndpoint::Start,
-                                    MarkerType::Start,
-                                    angle_from_vector(outgoing_vx, outgoing_vy),
-                                    emit_fn);
+                        emit_marker(
+                            segment,
+                            MarkerEndpoint::Start,
+                            MarkerType::Start,
+                            angle_from_vector(outgoing_vx, outgoing_vy),
+                            emit_fn,
+                        );
 
                         subpath_state = SubpathState::InSubpath;
                     }
@@ -750,11 +790,13 @@ fn emit_markers_for_path_builder<E>(builder: &RsvgPathBuilder, emit_fn: &mut E)
                             angle = 0.0;
                         }
 
-                        emit_marker(segment,
-                                    MarkerEndpoint::Start,
-                                    MarkerType::Middle,
-                                    angle,
-                                    emit_fn);
+                        emit_marker(
+                            segment,
+                            MarkerEndpoint::Start,
+                            MarkerType::Middle,
+                            angle,
+                            emit_fn,
+                        );
                     }
                 }
             }
@@ -772,18 +814,22 @@ fn emit_markers_for_path_builder<E>(builder: &RsvgPathBuilder, emit_fn: &mut E)
                 if let PathCommand::ClosePath = builder.get_path_commands()[segments.len()] {
                     let (_, outgoing_vx, outgoing_vy) =
                         find_outgoing_directionality_forwards(&segments, 0);
-                    bisect_angles(angle_from_vector(incoming_vx, incoming_vy),
-                                  angle_from_vector(outgoing_vx, outgoing_vy))
+                    bisect_angles(
+                        angle_from_vector(incoming_vx, incoming_vy),
+                        angle_from_vector(outgoing_vx, outgoing_vy),
+                    )
                 } else {
                     angle_from_vector(incoming_vx, incoming_vy)
                 }
             };
 
-            emit_marker(segment,
-                        MarkerEndpoint::End,
-                        MarkerType::End,
-                        angle,
-                        emit_fn);
+            emit_marker(
+                segment,
+                MarkerEndpoint::End,
+                MarkerType::End,
+                angle,
+                emit_fn,
+            );
         }
     }
 }
@@ -796,26 +842,32 @@ mod parser_tests {
     #[test]
     fn parsing_invalid_marker_units_yields_error() {
         assert!(is_parse_error(&MarkerUnits::parse("", ()).map_err(|e| AttributeError::from(e))));
-        assert!(is_parse_error(&MarkerUnits::parse("foo", ()).map_err(|e| {
-                                                                          AttributeError::from(e)
-                                                                      })));
+        assert!(
+            is_parse_error(&MarkerUnits::parse("foo", ()).map_err(|e| AttributeError::from(e)))
+        );
     }
 
     #[test]
     fn parses_marker_units() {
-        assert_eq!(MarkerUnits::parse("userSpaceOnUse", ()),
-                   Ok(MarkerUnits::UserSpaceOnUse));
-        assert_eq!(MarkerUnits::parse("strokeWidth", ()),
-                   Ok(MarkerUnits::StrokeWidth));
+        assert_eq!(
+            MarkerUnits::parse("userSpaceOnUse", ()),
+            Ok(MarkerUnits::UserSpaceOnUse)
+        );
+        assert_eq!(
+            MarkerUnits::parse("strokeWidth", ()),
+            Ok(MarkerUnits::StrokeWidth)
+        );
     }
 
     #[test]
     fn parsing_invalid_marker_orient_yields_error() {
         assert!(is_parse_error(&MarkerOrient::parse("", ()).map_err(|e| AttributeError::from(e))));
-        assert!(is_parse_error(&MarkerOrient::parse("blah", ()).map_err(|e| {
-                                                                            AttributeError::from(e)
-                                                                        })));
-        assert! (is_parse_error (&MarkerOrient::parse ("45blah", ()).map_err (|e| AttributeError::from 
(e))));
+        assert!(
+            is_parse_error(&MarkerOrient::parse("blah", ()).map_err(|e| AttributeError::from(e)))
+        );
+        assert!(
+            is_parse_error(&MarkerOrient::parse("45blah", ()).map_err(|e| AttributeError::from(e)))
+        );
     }
 
     #[test]
@@ -823,14 +875,22 @@ mod parser_tests {
         assert_eq!(MarkerOrient::parse("auto", ()), Ok(MarkerOrient::Auto));
 
         assert_eq!(MarkerOrient::parse("0", ()), Ok(MarkerOrient::Degrees(0.0)));
-        assert_eq!(MarkerOrient::parse("180", ()),
-                   Ok(MarkerOrient::Degrees(180.0)));
-        assert_eq!(MarkerOrient::parse("180deg", ()),
-                   Ok(MarkerOrient::Degrees(180.0)));
-        assert_eq!(MarkerOrient::parse("-400grad", ()),
-                   Ok(MarkerOrient::Degrees(-360.0)));
-        assert_eq!(MarkerOrient::parse("1rad", ()),
-                   Ok(MarkerOrient::Degrees(180.0 / PI)));
+        assert_eq!(
+            MarkerOrient::parse("180", ()),
+            Ok(MarkerOrient::Degrees(180.0))
+        );
+        assert_eq!(
+            MarkerOrient::parse("180deg", ()),
+            Ok(MarkerOrient::Degrees(180.0))
+        );
+        assert_eq!(
+            MarkerOrient::parse("-400grad", ()),
+            Ok(MarkerOrient::Degrees(-360.0))
+        );
+        assert_eq!(
+            MarkerOrient::parse("1rad", ()),
+            Ok(MarkerOrient::Degrees(180.0 / PI))
+        );
     }
 }
 
@@ -839,13 +899,17 @@ mod directionality_tests {
     use super::*;
     use std::f64::consts::*;
 
-    fn test_bisection_angle(expected: f64,
-                            incoming_vx: f64,
-                            incoming_vy: f64,
-                            outgoing_vx: f64,
-                            outgoing_vy: f64) {
-        let bisected = super::bisect_angles(super::angle_from_vector(incoming_vx, incoming_vy),
-                                            super::angle_from_vector(outgoing_vx, outgoing_vy));
+    fn test_bisection_angle(
+        expected: f64,
+        incoming_vx: f64,
+        incoming_vy: f64,
+        outgoing_vx: f64,
+        outgoing_vy: f64,
+    ) {
+        let bisected = super::bisect_angles(
+            super::angle_from_vector(incoming_vx, incoming_vy),
+            super::angle_from_vector(outgoing_vx, outgoing_vy),
+        );
         assert!(double_equals(expected, bisected));
     }
 
@@ -946,12 +1010,13 @@ mod directionality_tests {
 
     #[test]
     fn path_to_segments_handles_multiple_open_subpaths() {
-        let expected_segments: Vec<Segment> =
-            vec![line(10.0, 10.0, 20.0, 10.0),
-                 line(20.0, 10.0, 20.0, 20.0),
-                 line(30.0, 30.0, 40.0, 30.0),
-                 curve(40.0, 30.0, 50.0, 35.0, 60.0, 60.0, 70.0, 70.0),
-                 line(70.0, 70.0, 80.0, 90.0)];
+        let expected_segments: Vec<Segment> = vec![
+            line(10.0, 10.0, 20.0, 10.0),
+            line(20.0, 10.0, 20.0, 20.0),
+            line(30.0, 30.0, 40.0, 30.0),
+            curve(40.0, 30.0, 50.0, 35.0, 60.0, 60.0, 70.0, 70.0),
+            line(70.0, 70.0, 80.0, 90.0),
+        ];
 
         test_path_builder_to_segments(&setup_multiple_open_subpaths(), expected_segments);
     }
@@ -971,9 +1036,11 @@ mod directionality_tests {
 
     #[test]
     fn path_to_segments_handles_closed_subpath() {
-        let expected_segments: Vec<Segment> = vec![line(10.0, 10.0, 20.0, 10.0),
-                                                   line(20.0, 10.0, 20.0, 20.0),
-                                                   line(20.0, 20.0, 10.0, 10.0)];
+        let expected_segments: Vec<Segment> = vec![
+            line(10.0, 10.0, 20.0, 10.0),
+            line(20.0, 10.0, 20.0, 20.0),
+            line(20.0, 20.0, 10.0, 10.0),
+        ];
 
         test_path_builder_to_segments(&setup_closed_subpath(), expected_segments);
     }
@@ -1001,14 +1068,15 @@ mod directionality_tests {
 
     #[test]
     fn path_to_segments_handles_multiple_closed_subpaths() {
-        let expected_segments: Vec<Segment> =
-            vec![line(10.0, 10.0, 20.0, 10.0),
-                 line(20.0, 10.0, 20.0, 20.0),
-                 line(20.0, 20.0, 10.0, 10.0),
-                 line(30.0, 30.0, 40.0, 30.0),
-                 curve(40.0, 30.0, 50.0, 35.0, 60.0, 60.0, 70.0, 70.0),
-                 line(70.0, 70.0, 80.0, 90.0),
-                 line(80.0, 90.0, 30.0, 30.0)];
+        let expected_segments: Vec<Segment> = vec![
+            line(10.0, 10.0, 20.0, 10.0),
+            line(20.0, 10.0, 20.0, 20.0),
+            line(20.0, 20.0, 10.0, 10.0),
+            line(30.0, 30.0, 40.0, 30.0),
+            curve(40.0, 30.0, 50.0, 35.0, 60.0, 60.0, 70.0, 70.0),
+            line(70.0, 70.0, 80.0, 90.0),
+            line(80.0, 90.0, 30.0, 30.0),
+        ];
 
         test_path_builder_to_segments(&setup_multiple_closed_subpaths(), expected_segments);
     }
@@ -1032,10 +1100,12 @@ mod directionality_tests {
 
     #[test]
     fn path_to_segments_handles_no_moveto_after_closepath() {
-        let expected_segments: Vec<Segment> = vec![line(10.0, 10.0, 20.0, 10.0),
-                                                   line(20.0, 10.0, 20.0, 20.0),
-                                                   line(20.0, 20.0, 10.0, 10.0),
-                                                   line(10.0, 10.0, 40.0, 30.0)];
+        let expected_segments: Vec<Segment> = vec![
+            line(10.0, 10.0, 20.0, 10.0),
+            line(20.0, 10.0, 20.0, 20.0),
+            line(20.0, 20.0, 10.0, 10.0),
+            line(10.0, 10.0, 40.0, 30.0),
+        ];
 
         test_path_builder_to_segments(&setup_no_moveto_after_closepath(), expected_segments);
     }
@@ -1096,7 +1166,8 @@ mod directionality_tests {
     #[test]
     fn curve_has_directionality() {
         let (v1x, v1y, v2x, v2y) =
-            super::get_segment_directionalities (&curve (1.0, 2.0, 3.0, 5.0, 8.0, 13.0, 20.0, 33.0)).unwrap 
();
+            super::get_segment_directionalities(&curve(1.0, 2.0, 3.0, 5.0, 8.0, 13.0, 20.0, 33.0))
+                .unwrap();
         assert_eq!((2.0, 3.0), (v1x, v1y));
         assert_eq!((12.0, 20.0), (v2x, v2y));
     }
@@ -1104,30 +1175,37 @@ mod directionality_tests {
     #[test]
     fn curves_with_loops_and_coincident_ends_have_directionality() {
         let (v1x, v1y, v2x, v2y) =
-            super::get_segment_directionalities (&curve (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 1.0, 2.0)).unwrap ();
+            super::get_segment_directionalities(&curve(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 1.0, 2.0))
+                .unwrap();
         assert_eq!((2.0, 2.0), (v1x, v1y));
         assert_eq!((-4.0, -4.0), (v2x, v2y));
 
         let (v1x, v1y, v2x, v2y) =
-            super::get_segment_directionalities (&curve (1.0, 2.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0)).unwrap ();
+            super::get_segment_directionalities(&curve(1.0, 2.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0))
+                .unwrap();
         assert_eq!((2.0, 2.0), (v1x, v1y));
         assert_eq!((-2.0, -2.0), (v2x, v2y));
 
         let (v1x, v1y, v2x, v2y) =
-            super::get_segment_directionalities (&curve (1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 1.0, 2.0)).unwrap ();
+            super::get_segment_directionalities(&curve(1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 1.0, 2.0))
+                .unwrap();
         assert_eq!((2.0, 2.0), (v1x, v1y));
         assert_eq!((-2.0, -2.0), (v2x, v2y));
     }
 
     #[test]
     fn curve_with_coincident_control_points_has_no_directionality() {
-        assert! (super::get_segment_directionalities (&curve (1.0, 2.0, 1.0, 2.0, 1.0, 2.0, 1.0, 
2.0)).is_none ());
+        assert!(
+            super::get_segment_directionalities(&curve(1.0, 2.0, 1.0, 2.0, 1.0, 2.0, 1.0, 2.0))
+                .is_none()
+        );
     }
 
     #[test]
     fn curve_with_123_coincident_has_directionality() {
         let (v1x, v1y, v2x, v2y) =
-            super::get_segment_directionalities (&curve (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 20.0, 40.0)).unwrap 
();
+            super::get_segment_directionalities(&curve(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 20.0, 40.0))
+                .unwrap();
         assert_eq!((20.0, 40.0), (v1x, v1y));
         assert_eq!((20.0, 40.0), (v2x, v2y));
     }
@@ -1135,7 +1213,8 @@ mod directionality_tests {
     #[test]
     fn curve_with_234_coincident_has_directionality() {
         let (v1x, v1y, v2x, v2y) =
-            super::get_segment_directionalities (&curve (20.0, 40.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)).unwrap 
();
+            super::get_segment_directionalities(&curve(20.0, 40.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0))
+                .unwrap();
 
         assert_eq!((-20.0, -40.0), (v1x, v1y));
         assert_eq!((-20.0, -40.0), (v2x, v2y));
@@ -1143,8 +1222,16 @@ mod directionality_tests {
 
     #[test]
     fn curve_with_12_34_coincident_has_directionality() {
-        let (v1x, v1y, v2x, v2y) =
-            super::get_segment_directionalities (&curve (20.0, 40.0, 20.0, 40.0, 60.0, 70.0, 60.0, 
70.0)).unwrap ();
+        let (v1x, v1y, v2x, v2y) = super::get_segment_directionalities(&curve(
+            20.0,
+            40.0,
+            20.0,
+            40.0,
+            60.0,
+            70.0,
+            60.0,
+            70.0,
+        )).unwrap();
 
         assert_eq!((40.0, 30.0), (v1x, v1y));
         assert_eq!((40.0, 30.0), (v2x, v2y));
@@ -1165,16 +1252,22 @@ mod marker_tests {
 
         let mut v = Vec::new();
 
-        emit_markers_for_path_builder (&builder,
-                                       &mut |marker_type: MarkerType, x: f64, y: f64, computed_angle: f64| {
-                                           v.push ((marker_type, x, y, computed_angle));
-                                       });
-
-        assert_eq!(v,
-                   vec![(MarkerType::Start, 0.0, 0.0, 0.0),
-                        (MarkerType::Middle, 1.0, 0.0, angle_from_vector(1.0, 1.0)),
-                        (MarkerType::Middle, 1.0, 1.0, angle_from_vector(-1.0, 1.0)),
-                        (MarkerType::End, 0.0, 1.0, angle_from_vector(-1.0, 0.0))]);
+        emit_markers_for_path_builder(
+            &builder,
+            &mut |marker_type: MarkerType, x: f64, y: f64, computed_angle: f64| {
+                v.push((marker_type, x, y, computed_angle));
+            },
+        );
+
+        assert_eq!(
+            v,
+            vec![
+                (MarkerType::Start, 0.0, 0.0, 0.0),
+                (MarkerType::Middle, 1.0, 0.0, angle_from_vector(1.0, 1.0)),
+                (MarkerType::Middle, 1.0, 1.0, angle_from_vector(-1.0, 1.0)),
+                (MarkerType::End, 0.0, 1.0, angle_from_vector(-1.0, 0.0)),
+            ]
+        );
     }
 
     #[test]
@@ -1188,16 +1281,22 @@ mod marker_tests {
 
         let mut v = Vec::new();
 
-        emit_markers_for_path_builder (&builder,
-                                       &mut |marker_type: MarkerType, x: f64, y: f64, computed_angle: f64| {
-                                           v.push ((marker_type, x, y, computed_angle));
-                                       });
-
-        assert_eq!(v,
-                   vec![(MarkerType::Start, 0.0, 0.0, 0.0),
-                        (MarkerType::Middle, 1.0, 0.0, angle_from_vector(1.0, 1.0)),
-                        (MarkerType::Middle, 1.0, 1.0, angle_from_vector(-1.0, 1.0)),
-                        (MarkerType::Middle, 0.0, 1.0, angle_from_vector(-1.0, -1.0)),
-                        (MarkerType::End, 0.0, 0.0, angle_from_vector(1.0, -1.0))]);
+        emit_markers_for_path_builder(
+            &builder,
+            &mut |marker_type: MarkerType, x: f64, y: f64, computed_angle: f64| {
+                v.push((marker_type, x, y, computed_angle));
+            },
+        );
+
+        assert_eq!(
+            v,
+            vec![
+                (MarkerType::Start, 0.0, 0.0, 0.0),
+                (MarkerType::Middle, 1.0, 0.0, angle_from_vector(1.0, 1.0)),
+                (MarkerType::Middle, 1.0, 1.0, angle_from_vector(-1.0, 1.0)),
+                (MarkerType::Middle, 0.0, 1.0, angle_from_vector(-1.0, -1.0)),
+                (MarkerType::End, 0.0, 0.0, angle_from_vector(1.0, -1.0)),
+            ]
+        );
     }
 }
diff --git a/rsvg_internals/src/mask.rs b/rsvg_internals/src/mask.rs
index af3a517d..c01ec874 100644
--- a/rsvg_internals/src/mask.rs
+++ b/rsvg_internals/src/mask.rs
@@ -25,14 +25,16 @@ struct NodeMask {
 
 impl NodeMask {
     fn new() -> NodeMask {
-        NodeMask { x: Cell::new(NodeMask::get_default_pos(LengthDir::Horizontal)),
-                   y: Cell::new(NodeMask::get_default_pos(LengthDir::Vertical)),
+        NodeMask {
+            x: Cell::new(NodeMask::get_default_pos(LengthDir::Horizontal)),
+            y: Cell::new(NodeMask::get_default_pos(LengthDir::Vertical)),
 
-                   width: Cell::new(NodeMask::get_default_size(LengthDir::Horizontal)),
-                   height: Cell::new(NodeMask::get_default_size(LengthDir::Vertical)),
+            width: Cell::new(NodeMask::get_default_size(LengthDir::Horizontal)),
+            height: Cell::new(NodeMask::get_default_size(LengthDir::Vertical)),
 
-                   units: Cell::new(MaskUnits::default()),
-                   content_units: Cell::new(MaskContentUnits::default()), }
+            units: Cell::new(MaskUnits::default()),
+            content_units: Cell::new(MaskContentUnits::default()),
+        }
     }
 
     fn get_default_pos(dir: LengthDir) -> RsvgLength {
@@ -50,19 +52,24 @@ impl NodeTrait for NodeMask {
             match attr {
                 Attribute::X => self.x.set(parse("x", value, LengthDir::Horizontal, None)?),
                 Attribute::Y => self.y.set(parse("y", value, LengthDir::Vertical, None)?),
-                Attribute::Width => self.width.set(parse("width",
-                                                         value,
-                                                         LengthDir::Horizontal,
-                                                         Some(RsvgLength::check_nonnegative))?),
-                Attribute::Height => self.height.set(parse("height",
-                                                           value,
-                                                           LengthDir::Vertical,
-                                                           Some(RsvgLength::check_nonnegative))?),
+                Attribute::Width => self.width.set(parse(
+                    "width",
+                    value,
+                    LengthDir::Horizontal,
+                    Some(RsvgLength::check_nonnegative),
+                )?),
+                Attribute::Height => self.height.set(parse(
+                    "height",
+                    value,
+                    LengthDir::Vertical,
+                    Some(RsvgLength::check_nonnegative),
+                )?),
 
                 Attribute::MaskUnits => self.units.set(parse("maskUnits", value, (), None)?),
 
                 Attribute::MaskContentUnits => {
-                    self.content_units.set(parse("maskContentUnits", value, (), None)?)
+                    self.content_units
+                        .set(parse("maskContentUnits", value, (), None)?)
                 }
 
                 _ => (),
@@ -82,9 +89,10 @@ impl NodeTrait for NodeMask {
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_mask_new(_: *const libc::c_char,
-                                     raw_parent: *const RsvgNode)
-                                     -> *const RsvgNode {
+pub extern "C" fn rsvg_node_mask_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
     boxed_node_new(NodeType::Mask, raw_parent, Box::new(NodeMask::new()))
 }
 
@@ -96,8 +104,8 @@ pub extern "C" fn rsvg_node_mask_get_x(raw_node: *const RsvgNode) -> RsvgLength
     let mut v = RsvgLength::default();
 
     node.with_impl(|mask: &NodeMask| {
-                       v = mask.x.get();
-                   });
+        v = mask.x.get();
+    });
 
     v
 }
@@ -110,8 +118,8 @@ pub extern "C" fn rsvg_node_mask_get_y(raw_node: *const RsvgNode) -> RsvgLength
     let mut v = RsvgLength::default();
 
     node.with_impl(|mask: &NodeMask| {
-                       v = mask.y.get();
-                   });
+        v = mask.y.get();
+    });
 
     v
 }
@@ -124,8 +132,8 @@ pub extern "C" fn rsvg_node_mask_get_width(raw_node: *const RsvgNode) -> RsvgLen
     let mut v = RsvgLength::default();
 
     node.with_impl(|mask: &NodeMask| {
-                       v = mask.width.get();
-                   });
+        v = mask.width.get();
+    });
 
     v
 }
@@ -138,8 +146,8 @@ pub extern "C" fn rsvg_node_mask_get_height(raw_node: *const RsvgNode) -> RsvgLe
     let mut v = RsvgLength::default();
 
     node.with_impl(|mask: &NodeMask| {
-                       v = mask.height.get();
-                   });
+        v = mask.height.get();
+    });
 
     v
 }
@@ -152,8 +160,8 @@ pub extern "C" fn rsvg_node_mask_get_units(raw_node: *const RsvgNode) -> CoordUn
     let mut units = MaskUnits::default();
 
     node.with_impl(|mask: &NodeMask| {
-                       units = mask.units.get();
-                   });
+        units = mask.units.get();
+    });
 
     CoordUnits::from(units)
 }
@@ -166,8 +174,8 @@ pub extern "C" fn rsvg_node_mask_get_content_units(raw_node: *const RsvgNode) ->
     let mut units = MaskContentUnits::default();
 
     node.with_impl(|mask: &NodeMask| {
-                       units = mask.content_units.get();
-                   });
+        units = mask.content_units.get();
+    });
 
     CoordUnits::from(units)
 }
diff --git a/rsvg_internals/src/node.rs b/rsvg_internals/src/node.rs
index f93e54ee..9277fb25 100644
--- a/rsvg_internals/src/node.rs
+++ b/rsvg_internals/src/node.rs
@@ -25,11 +25,12 @@ pub type RsvgNode = Rc<Node>;
 pub enum RsvgCNodeImpl {}
 
 pub trait NodeTrait: Downcast {
-    fn set_atts(&self,
-                node: &RsvgNode,
-                handle: *const RsvgHandle,
-                pbag: &PropertyBag)
-                -> NodeResult;
+    fn set_atts(
+        &self,
+        node: &RsvgNode,
+        handle: *const RsvgHandle,
+        pbag: &PropertyBag,
+    ) -> NodeResult;
     fn draw(&self, node: &RsvgNode, draw_ctx: *const RsvgDrawingCtx, dominate: i32);
     fn get_c_impl(&self) -> *const RsvgCNodeImpl;
 }
@@ -126,17 +127,20 @@ pub enum NodeType {
 }
 
 impl Node {
-    pub fn new(node_type: NodeType,
-               parent: Option<Weak<Node>>,
-               state: *mut RsvgState,
-               node_impl: Box<NodeTrait>)
-               -> Node {
-        Node { node_type,
-               parent,
-               children: RefCell::new(Vec::new()),
-               state,
-               result: RefCell::new(Ok(())),
-               node_impl, }
+    pub fn new(
+        node_type: NodeType,
+        parent: Option<Weak<Node>>,
+        state: *mut RsvgState,
+        node_impl: Box<NodeTrait>,
+    ) -> Node {
+        Node {
+            node_type,
+            parent,
+            children: RefCell::new(Vec::new()),
+            state,
+            result: RefCell::new(Ok(())),
+            node_impl,
+        }
     }
 
     pub fn get_type(&self) -> NodeType {
@@ -210,14 +214,14 @@ impl Node {
         }
 
         self.foreach_child(|child| {
-                               let boxed_child = box_node(child.clone());
+            let boxed_child = box_node(child.clone());
 
-                               drawing_ctx::draw_node_from_stack(draw_ctx, boxed_child, 0);
+            drawing_ctx::draw_node_from_stack(draw_ctx, boxed_child, 0);
 
-                               rsvg_node_unref(boxed_child);
+            rsvg_node_unref(boxed_child);
 
-                               true
-                           });
+            true
+        });
 
         if dominate != -1 {
             drawing_ctx::pop_discrete_layer(draw_ctx);
@@ -225,7 +229,8 @@ impl Node {
     }
 
     pub fn foreach_child<F>(&self, mut f: F)
-        where F: FnMut(Rc<Node>) -> bool
+    where
+        F: FnMut(Rc<Node>) -> bool,
     {
         for c in &*self.children.borrow() {
             let next = f(c.clone());
@@ -265,14 +270,17 @@ pub fn node_ptr_to_weak(raw_parent: *const RsvgNode) -> Option<Weak<Node>> {
     }
 }
 
-pub fn boxed_node_new(node_type: NodeType,
-                      raw_parent: *const RsvgNode,
-                      node_impl: Box<NodeTrait>)
-                      -> *mut RsvgNode {
-    box_node(Rc::new(Node::new(node_type,
-                               node_ptr_to_weak(raw_parent),
-                               drawing_ctx::state_new(),
-                               node_impl)))
+pub fn boxed_node_new(
+    node_type: NodeType,
+    raw_parent: *const RsvgNode,
+    node_impl: Box<NodeTrait>,
+) -> *mut RsvgNode {
+    box_node(Rc::new(Node::new(
+        node_type,
+        node_ptr_to_weak(raw_parent),
+        drawing_ctx::state_new(),
+        node_impl,
+    )))
 }
 
 #[no_mangle]
@@ -326,9 +334,10 @@ fn rc_node_ptr_eq<T: ?Sized>(this: &Rc<T>, other: &Rc<T>) -> bool {
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_is_same(raw_node1: *const RsvgNode,
-                                    raw_node2: *const RsvgNode)
-                                    -> glib_sys::gboolean {
+pub extern "C" fn rsvg_node_is_same(
+    raw_node1: *const RsvgNode,
+    raw_node2: *const RsvgNode,
+) -> glib_sys::gboolean {
     let is_same = if raw_node1.is_null() && raw_node2.is_null() {
         true
     } else if !raw_node1.is_null() && !raw_node2.is_null() {
@@ -362,9 +371,11 @@ pub extern "C" fn rsvg_node_add_child(raw_node: *mut RsvgNode, raw_child: *const
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_set_atts(raw_node: *mut RsvgNode,
-                                     handle: *const RsvgHandle,
-                                     pbag: *const PropertyBag) {
+pub extern "C" fn rsvg_node_set_atts(
+    raw_node: *mut RsvgNode,
+    handle: *const RsvgHandle,
+    pbag: *const PropertyBag,
+) {
     assert!(!raw_node.is_null());
     assert!(!pbag.is_null());
 
@@ -375,9 +386,11 @@ pub extern "C" fn rsvg_node_set_atts(raw_node: *mut RsvgNode,
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_draw(raw_node: *const RsvgNode,
-                                 draw_ctx: *const RsvgDrawingCtx,
-                                 dominate: i32) {
+pub extern "C" fn rsvg_node_draw(
+    raw_node: *const RsvgNode,
+    draw_ctx: *const RsvgDrawingCtx,
+    dominate: i32,
+) {
     assert!(!raw_node.is_null());
     let node: &RsvgNode = unsafe { &*raw_node };
 
@@ -385,9 +398,11 @@ pub extern "C" fn rsvg_node_draw(raw_node: *const RsvgNode,
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_set_attribute_parse_error(raw_node: *const RsvgNode,
-                                                      attr_name: *const libc::c_char,
-                                                      description: *const libc::c_char) {
+pub extern "C" fn rsvg_node_set_attribute_parse_error(
+    raw_node: *const RsvgNode,
+    attr_name: *const libc::c_char,
+    description: *const libc::c_char,
+) {
     assert!(!raw_node.is_null());
     let node: &RsvgNode = unsafe { &*raw_node };
 
@@ -395,8 +410,10 @@ pub extern "C" fn rsvg_node_set_attribute_parse_error(raw_node: *const RsvgNode,
     assert!(!description.is_null());
 
     unsafe {
-        node.set_error (NodeError::parse_error (&String::from_glib_none (attr_name),
-                                                ParseError::new (&String::from_glib_none (description))));
+        node.set_error(NodeError::parse_error(
+            &String::from_glib_none(attr_name),
+            ParseError::new(&String::from_glib_none(description)),
+        ));
     }
 }
 
@@ -404,27 +421,31 @@ type NodeForeachChild =
     unsafe extern "C" fn(node: *const RsvgNode, data: *const libc::c_void) -> glib_sys::gboolean;
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_foreach_child(raw_node: *const RsvgNode,
-                                          func: NodeForeachChild,
-                                          data: *const libc::c_void) {
+pub extern "C" fn rsvg_node_foreach_child(
+    raw_node: *const RsvgNode,
+    func: NodeForeachChild,
+    data: *const libc::c_void,
+) {
     assert!(!raw_node.is_null());
     let node: &RsvgNode = unsafe { &*raw_node };
 
     node.foreach_child(|child| {
-                           let boxed_child = box_node(child.clone());
+        let boxed_child = box_node(child.clone());
 
-                           let next: bool = unsafe { from_glib(func(boxed_child, data)) };
+        let next: bool = unsafe { from_glib(func(boxed_child, data)) };
 
-                           rsvg_node_unref(boxed_child);
+        rsvg_node_unref(boxed_child);
 
-                           next
-                       });
+        next
+    });
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_draw_children(raw_node: *const RsvgNode,
-                                          draw_ctx: *const RsvgDrawingCtx,
-                                          dominate: i32) {
+pub extern "C" fn rsvg_node_draw_children(
+    raw_node: *const RsvgNode,
+    draw_ctx: *const RsvgDrawingCtx,
+    dominate: i32,
+) {
     assert!(!raw_node.is_null());
     let node: &RsvgNode = unsafe { &*raw_node };
 
@@ -455,10 +476,12 @@ mod tests {
 
     #[test]
     fn node_refs_and_unrefs() {
-        let node = Rc::new(Node::new(NodeType::Path,
-                                     None,
-                                     ptr::null_mut(),
-                                     Box::new(TestNodeImpl {})));
+        let node = Rc::new(Node::new(
+            NodeType::Path,
+            None,
+            ptr::null_mut(),
+            Box::new(TestNodeImpl {}),
+        ));
 
         let ref1 = box_node(node);
 
@@ -477,10 +500,12 @@ mod tests {
 
     #[test]
     fn reffed_node_is_same_as_original_node() {
-        let node = Rc::new(Node::new(NodeType::Path,
-                                     None,
-                                     ptr::null_mut(),
-                                     Box::new(TestNodeImpl {})));
+        let node = Rc::new(Node::new(
+            NodeType::Path,
+            None,
+            ptr::null_mut(),
+            Box::new(TestNodeImpl {}),
+        ));
 
         let ref1 = box_node(node);
 
@@ -494,17 +519,21 @@ mod tests {
 
     #[test]
     fn different_nodes_have_different_pointers() {
-        let node1 = Rc::new(Node::new(NodeType::Path,
-                                      None,
-                                      ptr::null_mut(),
-                                      Box::new(TestNodeImpl {})));
+        let node1 = Rc::new(Node::new(
+            NodeType::Path,
+            None,
+            ptr::null_mut(),
+            Box::new(TestNodeImpl {}),
+        ));
 
         let ref1 = box_node(node1);
 
-        let node2 = Rc::new(Node::new(NodeType::Path,
-                                      None,
-                                      ptr::null_mut(),
-                                      Box::new(TestNodeImpl {})));
+        let node2 = Rc::new(Node::new(
+            NodeType::Path,
+            None,
+            ptr::null_mut(),
+            Box::new(TestNodeImpl {}),
+        ));
 
         let ref2 = box_node(node2);
 
@@ -516,25 +545,31 @@ mod tests {
 
     #[test]
     fn node_is_its_own_ancestor() {
-        let node = Rc::new(Node::new(NodeType::Path,
-                                     None,
-                                     ptr::null_mut(),
-                                     Box::new(TestNodeImpl {})));
+        let node = Rc::new(Node::new(
+            NodeType::Path,
+            None,
+            ptr::null_mut(),
+            Box::new(TestNodeImpl {}),
+        ));
 
         assert!(Node::is_ancestor(node.clone(), node.clone()));
     }
 
     #[test]
     fn node_is_ancestor_of_child() {
-        let node = Rc::new(Node::new(NodeType::Path,
-                                     None,
-                                     ptr::null_mut(),
-                                     Box::new(TestNodeImpl {})));
-
-        let child = Rc::new(Node::new(NodeType::Path,
-                                      Some(Rc::downgrade(&node)),
-                                      ptr::null_mut(),
-                                      Box::new(TestNodeImpl {})));
+        let node = Rc::new(Node::new(
+            NodeType::Path,
+            None,
+            ptr::null_mut(),
+            Box::new(TestNodeImpl {}),
+        ));
+
+        let child = Rc::new(Node::new(
+            NodeType::Path,
+            Some(Rc::downgrade(&node)),
+            ptr::null_mut(),
+            Box::new(TestNodeImpl {}),
+        ));
 
         node.add_child(&child);
 
diff --git a/rsvg_internals/src/opacity.rs b/rsvg_internals/src/opacity.rs
index e4c3125a..8f360ef0 100644
--- a/rsvg_internals/src/opacity.rs
+++ b/rsvg_internals/src/opacity.rs
@@ -36,14 +36,20 @@ pub enum Opacity {
 impl From<Result<Opacity, AttributeError>> for OpacitySpec {
     fn from(result: Result<Opacity, AttributeError>) -> OpacitySpec {
         match result {
-            Ok(Opacity::Inherit) => OpacitySpec { kind: OpacityKind::Inherit,
-                                                  opacity: 0, },
-
-            Ok(Opacity::Specified(val)) => OpacitySpec { kind: OpacityKind::Specified,
-                                                         opacity: opacity_to_u8(val), },
-
-            _ => OpacitySpec { kind: OpacityKind::ParseError,
-                               opacity: 0, },
+            Ok(Opacity::Inherit) => OpacitySpec {
+                kind: OpacityKind::Inherit,
+                opacity: 0,
+            },
+
+            Ok(Opacity::Specified(val)) => OpacitySpec {
+                kind: OpacityKind::Specified,
+                opacity: opacity_to_u8(val),
+            },
+
+            _ => OpacitySpec {
+                kind: OpacityKind::ParseError,
+                opacity: 0,
+            },
         }
     }
 }
@@ -98,14 +104,20 @@ impl FromStr for Opacity {
 impl Opacity {
     pub fn from_opacity_spec(spec: &OpacitySpec) -> Result<Opacity, AttributeError> {
         match *spec {
-            OpacitySpec { kind: OpacityKind::Inherit,
-                          .. } => Ok(Opacity::Inherit),
-
-            OpacitySpec { kind: OpacityKind::Specified,
-                          opacity, } => Ok(Opacity::Specified(f64::from(opacity) / 255.0)),
-
-            OpacitySpec { kind: OpacityKind::ParseError,
-                          .. } => Err(AttributeError::Parse(ParseError::new("parse error"))),
+            OpacitySpec {
+                kind: OpacityKind::Inherit,
+                ..
+            } => Ok(Opacity::Inherit),
+
+            OpacitySpec {
+                kind: OpacityKind::Specified,
+                opacity,
+            } => Ok(Opacity::Specified(f64::from(opacity) / 255.0)),
+
+            OpacitySpec {
+                kind: OpacityKind::ParseError,
+                ..
+            } => Err(AttributeError::Parse(ParseError::new("parse error"))),
         }
     }
 }
@@ -150,7 +162,9 @@ mod tests {
 
     #[test]
     fn errors_on_extra_input() {
-        assert!(is_parse_error(&Opacity::from_str("inherit a million dollars")));
+        assert!(is_parse_error(&Opacity::from_str(
+            "inherit a million dollars"
+        )));
         assert!(is_parse_error(&Opacity::from_str("0.0foo")));
     }
 
@@ -160,20 +174,36 @@ mod tests {
 
     #[test]
     fn converts_result_to_opacity_spec() {
-        assert_eq!(parse("inherit"),
-                   OpacitySpec { kind: OpacityKind::Inherit,
-                                 opacity: 0, });
-
-        assert_eq!(parse("0"),
-                   OpacitySpec { kind: OpacityKind::Specified,
-                                 opacity: 0, });
-        assert_eq!(parse("1"),
-                   OpacitySpec { kind: OpacityKind::Specified,
-                                 opacity: 255, });
-
-        assert_eq!(parse("foo"),
-                   OpacitySpec { kind: OpacityKind::ParseError,
-                                 opacity: 0, });
+        assert_eq!(
+            parse("inherit"),
+            OpacitySpec {
+                kind: OpacityKind::Inherit,
+                opacity: 0,
+            }
+        );
+
+        assert_eq!(
+            parse("0"),
+            OpacitySpec {
+                kind: OpacityKind::Specified,
+                opacity: 0,
+            }
+        );
+        assert_eq!(
+            parse("1"),
+            OpacitySpec {
+                kind: OpacityKind::Specified,
+                opacity: 255,
+            }
+        );
+
+        assert_eq!(
+            parse("foo"),
+            OpacitySpec {
+                kind: OpacityKind::ParseError,
+                opacity: 0,
+            }
+        );
     }
 
     fn test_roundtrip(s: &str) {
diff --git a/rsvg_internals/src/paint_server.rs b/rsvg_internals/src/paint_server.rs
index c7afb6e7..55683512 100644
--- a/rsvg_internals/src/paint_server.rs
+++ b/rsvg_internals/src/paint_server.rs
@@ -29,9 +29,9 @@ impl Parse for PaintServerSpread {
             "pad" => Ok(PaintServerSpread(cairo::enums::Extend::Pad)),
             "reflect" => Ok(PaintServerSpread(cairo::enums::Extend::Reflect)),
             "repeat" => Ok(PaintServerSpread(cairo::enums::Extend::Repeat)),
-            _ => Err(AttributeError::Parse(ParseError::new("expected 'pad' | \
-                                                            'reflect' | \
-                                                            'repeat'"))),
+            _ => Err(AttributeError::Parse(ParseError::new(
+                "expected 'pad' | 'reflect' | 'repeat'",
+            ))),
         }
     }
 }
@@ -52,11 +52,14 @@ pub enum PaintServer {
 }
 
 impl PaintServer {
-    pub fn parse_input<'i, 't>(input: &mut cssparser::Parser<'i, 't>)
-                               -> Result<Self, AttributeError> {
+    pub fn parse_input<'i, 't>(
+        input: &mut cssparser::Parser<'i, 't>,
+    ) -> Result<Self, AttributeError> {
         if let Ok(url) = input.try(|i| i.expect_url()) {
-            Ok(PaintServer::Iri { iri: String::from(url.as_ref()),
-                                  alternate: PaintServer::parse_fallback(input), })
+            Ok(PaintServer::Iri {
+                iri: String::from(url.as_ref()),
+                alternate: PaintServer::parse_fallback(input),
+            })
         } else {
             PaintServer::parse_color(input).map(PaintServer::SolidColor)
         }
@@ -65,28 +68,32 @@ impl PaintServer {
     fn parse_color<'i, 't>(input: &mut cssparser::Parser<'i, 't>) -> Result<Color, AttributeError> {
         if input.try(|i| i.expect_ident_matching("inherit")).is_ok() {
             Ok(Color::Inherit)
-        } else if input.try(|i| i.expect_ident_matching("currentColor"))
-                       .is_ok()
+        } else if input
+            .try(|i| i.expect_ident_matching("currentColor"))
+            .is_ok()
         {
             Ok(Color::CurrentColor)
         } else {
-            input.try(|i| cssparser::Color::parse(i))
-                 .map(Color::from)
-                 .map_err(AttributeError::from)
+            input
+                .try(|i| cssparser::Color::parse(i))
+                .map(Color::from)
+                .map_err(AttributeError::from)
         }
     }
 
     fn parse_fallback<'i, 't>(input: &mut cssparser::Parser<'i, 't>) -> Option<Color> {
         if input.try(|i| i.expect_ident_matching("none")).is_ok() {
             None
-        } else if input.try(|i| i.expect_ident_matching("currentColor"))
-                       .is_ok()
+        } else if input
+            .try(|i| i.expect_ident_matching("currentColor"))
+            .is_ok()
         {
             Some(Color::CurrentColor)
         } else {
-            input.try(|i| cssparser::Color::parse(i))
-                 .ok()
-                 .map(|i| Color::from(i))
+            input
+                .try(|i| cssparser::Color::parse(i))
+                .ok()
+                .map(|i| Color::from(i))
         }
     }
 }
@@ -101,10 +108,12 @@ impl Parse for PaintServer {
     }
 }
 
-fn _set_source_rsvg_solid_color(ctx: *mut drawing_ctx::RsvgDrawingCtx,
-                                color: &Color,
-                                opacity: u8,
-                                current_color: u32) {
+fn _set_source_rsvg_solid_color(
+    ctx: *mut drawing_ctx::RsvgDrawingCtx,
+    color: &Color,
+    opacity: u8,
+    current_color: u32,
+) {
     let rgba_color = match *color {
         Color::RGBA(rgba) => Some(rgba),
         Color::CurrentColor => {
@@ -119,11 +128,12 @@ fn _set_source_rsvg_solid_color(ctx: *mut drawing_ctx::RsvgDrawingCtx,
     };
 
     if let Some(rgba) = rgba_color {
-        drawing_ctx::get_cairo_context(ctx).set_source_rgba(f64::from(rgba.red_f32()),
-                                                            f64::from(rgba.green_f32()),
-                                                            f64::from(rgba.blue_f32()),
-                                                            f64::from(rgba.alpha_f32())
-                                                            * (f64::from(opacity) / 255.0));
+        drawing_ctx::get_cairo_context(ctx).set_source_rgba(
+            f64::from(rgba.red_f32()),
+            f64::from(rgba.green_f32()),
+            f64::from(rgba.blue_f32()),
+            f64::from(rgba.alpha_f32()) * (f64::from(opacity) / 255.0),
+        );
     }
 }
 
@@ -134,9 +144,10 @@ fn _set_source_rsvg_solid_color(ctx: *mut drawing_ctx::RsvgDrawingCtx,
 ///
 /// * `str` - The SVG paint specification string to parse.
 #[no_mangle]
-pub extern "C" fn rsvg_paint_server_parse(inherit: *mut glib_sys::gboolean,
-                                          str: *const libc::c_char)
-                                          -> *const PaintServer {
+pub extern "C" fn rsvg_paint_server_parse(
+    inherit: *mut glib_sys::gboolean,
+    str: *const libc::c_char,
+) -> *const PaintServer {
     if !inherit.is_null() {
         unsafe {
             *inherit = true.to_glib();
@@ -154,10 +165,12 @@ pub extern "C" fn rsvg_paint_server_parse(inherit: *mut glib_sys::gboolean,
                 }
             }
 
-            *color = Color::RGBA(cssparser::RGBA { red: 0,
-                                                   green: 0,
-                                                   blue: 0,
-                                                   alpha: 255, });
+            *color = Color::RGBA(cssparser::RGBA {
+                red: 0,
+                green: 0,
+                blue: 0,
+                alpha: 255,
+            });
         }
     }
 
@@ -201,12 +214,13 @@ pub extern "C" fn rsvg_paint_server_unref(paint_server: *const PaintServer) {
 }
 
 #[no_mangle]
-pub extern "C" fn _set_source_rsvg_paint_server(c_ctx: *mut drawing_ctx::RsvgDrawingCtx,
-                                                c_ps: *const PaintServer,
-                                                opacity: u8,
-                                                c_bbox: RsvgBbox,
-                                                current_color: u32)
-                                                -> glib_sys::gboolean {
+pub extern "C" fn _set_source_rsvg_paint_server(
+    c_ctx: *mut drawing_ctx::RsvgDrawingCtx,
+    c_ps: *const PaintServer,
+    opacity: u8,
+    c_bbox: RsvgBbox,
+    current_color: u32,
+) -> glib_sys::gboolean {
     assert!(!c_ctx.is_null());
     assert!(!c_ps.is_null());
 
@@ -214,21 +228,24 @@ pub extern "C" fn _set_source_rsvg_paint_server(c_ctx: *mut drawing_ctx::RsvgDra
     let mut had_paint_server = false;
 
     match *ps {
-        PaintServer::Iri { ref iri,
-                           ref alternate, } => {
+        PaintServer::Iri {
+            ref iri,
+            ref alternate,
+        } => {
             let node_ptr = drawing_ctx::acquire_node(c_ctx, iri.as_str());
 
             if !node_ptr.is_null() {
                 let node = unsafe { &*node_ptr };
 
                 if node.get_type() == NodeType::LinearGradient
-                   || node.get_type() == NodeType::RadialGradient
+                    || node.get_type() == NodeType::RadialGradient
                 {
-                    had_paint_server =
-                        gradient::gradient_resolve_fallbacks_and_set_pattern(node,
-                                                                             c_ctx,
-                                                                             opacity,
-                                                                             &c_bbox);
+                    had_paint_server = gradient::gradient_resolve_fallbacks_and_set_pattern(
+                        node,
+                        c_ctx,
+                        opacity,
+                        &c_bbox,
+                    );
                 } else if node.get_type() == NodeType::Pattern {
                     had_paint_server =
                         pattern::pattern_resolve_fallbacks_and_set_pattern(node, c_ctx, &c_bbox);
@@ -236,10 +253,12 @@ pub extern "C" fn _set_source_rsvg_paint_server(c_ctx: *mut drawing_ctx::RsvgDra
             }
 
             if !had_paint_server && alternate.is_some() {
-                _set_source_rsvg_solid_color(c_ctx,
-                                             alternate.as_ref().unwrap(),
-                                             opacity,
-                                             current_color);
+                _set_source_rsvg_solid_color(
+                    c_ctx,
+                    alternate.as_ref().unwrap(),
+                    opacity,
+                    current_color,
+                );
                 had_paint_server = true;
             }
 
@@ -261,55 +280,91 @@ mod tests {
 
     #[test]
     fn parses_spread_method() {
-        assert_eq!(PaintServerSpread::parse("pad", ()),
-                   Ok(PaintServerSpread(cairo::enums::Extend::Pad)));
+        assert_eq!(
+            PaintServerSpread::parse("pad", ()),
+            Ok(PaintServerSpread(cairo::enums::Extend::Pad))
+        );
 
-        assert_eq!(PaintServerSpread::parse("reflect", ()),
-                   Ok(PaintServerSpread(cairo::enums::Extend::Reflect)));
+        assert_eq!(
+            PaintServerSpread::parse("reflect", ()),
+            Ok(PaintServerSpread(cairo::enums::Extend::Reflect))
+        );
 
-        assert_eq!(PaintServerSpread::parse("repeat", ()),
-                   Ok(PaintServerSpread(cairo::enums::Extend::Repeat)));
+        assert_eq!(
+            PaintServerSpread::parse("repeat", ()),
+            Ok(PaintServerSpread(cairo::enums::Extend::Repeat))
+        );
 
         assert!(PaintServerSpread::parse("foobar", ()).is_err());
     }
 
     #[test]
     fn parses_solid_color() {
-        assert_eq!(PaintServer::parse("rgb(255, 128, 64, 0.5)", ()),
-                   Ok(PaintServer::SolidColor(Color::from(0x80ff8040))));
-
-        assert_eq!(PaintServer::parse("inherit", ()),
-                   Ok(PaintServer::SolidColor(Color::Inherit)));
-
-        assert_eq!(PaintServer::parse("currentColor", ()),
-                   Ok(PaintServer::SolidColor(Color::CurrentColor)));
+        assert_eq!(
+            PaintServer::parse("rgb(255, 128, 64, 0.5)", ()),
+            Ok(PaintServer::SolidColor(Color::from(0x80ff8040)))
+        );
+
+        assert_eq!(
+            PaintServer::parse("inherit", ()),
+            Ok(PaintServer::SolidColor(Color::Inherit))
+        );
+
+        assert_eq!(
+            PaintServer::parse("currentColor", ()),
+            Ok(PaintServer::SolidColor(Color::CurrentColor))
+        );
     }
 
     #[test]
     fn parses_iri() {
-        assert_eq!(PaintServer::parse("url(#link)", ()),
-                   Ok(PaintServer::Iri { iri: "#link".to_string(),
-                                         alternate: None, }));
-
-        assert_eq!(PaintServer::parse("url(#link) none", ()),
-                   Ok(PaintServer::Iri { iri: "#link".to_string(),
-                                         alternate: None, }));
-
-        assert_eq!(PaintServer::parse("url(#link) #ff8040", ()),
-                   Ok(PaintServer::Iri { iri: "#link".to_string(),
-                                         alternate: Some(Color::from(0xffff8040)), }));
-
-        assert_eq!(PaintServer::parse("url(#link) rgb(255, 128, 64, 0.5)", ()),
-                   Ok(PaintServer::Iri { iri: "#link".to_string(),
-                                         alternate: Some(Color::from(0x80ff8040)), }));
-
-        assert_eq!(PaintServer::parse("url(#link) currentColor", ()),
-                   Ok(PaintServer::Iri { iri: "#link".to_string(),
-                                         alternate: Some(Color::CurrentColor), }));
-
-        assert_eq!(PaintServer::parse("url(#link) inherit", ()),
-                   Ok(PaintServer::Iri { iri: "#link".to_string(),
-                                         alternate: None, }));
+        assert_eq!(
+            PaintServer::parse("url(#link)", ()),
+            Ok(PaintServer::Iri {
+                iri: "#link".to_string(),
+                alternate: None,
+            })
+        );
+
+        assert_eq!(
+            PaintServer::parse("url(#link) none", ()),
+            Ok(PaintServer::Iri {
+                iri: "#link".to_string(),
+                alternate: None,
+            })
+        );
+
+        assert_eq!(
+            PaintServer::parse("url(#link) #ff8040", ()),
+            Ok(PaintServer::Iri {
+                iri: "#link".to_string(),
+                alternate: Some(Color::from(0xffff8040)),
+            })
+        );
+
+        assert_eq!(
+            PaintServer::parse("url(#link) rgb(255, 128, 64, 0.5)", ()),
+            Ok(PaintServer::Iri {
+                iri: "#link".to_string(),
+                alternate: Some(Color::from(0x80ff8040)),
+            })
+        );
+
+        assert_eq!(
+            PaintServer::parse("url(#link) currentColor", ()),
+            Ok(PaintServer::Iri {
+                iri: "#link".to_string(),
+                alternate: Some(Color::CurrentColor),
+            })
+        );
+
+        assert_eq!(
+            PaintServer::parse("url(#link) inherit", ()),
+            Ok(PaintServer::Iri {
+                iri: "#link".to_string(),
+                alternate: None,
+            })
+        );
     }
 
     #[test]
diff --git a/rsvg_internals/src/parsers.rs b/rsvg_internals/src/parsers.rs
index e2bae5a4..4999a936 100644
--- a/rsvg_internals/src/parsers.rs
+++ b/rsvg_internals/src/parsers.rs
@@ -19,7 +19,9 @@ pub struct ParseError {
 
 impl ParseError {
     pub fn new<T: AsRef<str>>(msg: T) -> ParseError {
-        ParseError { display: msg.as_ref().to_string(), }
+        ParseError {
+            display: msg.as_ref().to_string(),
+        }
     }
 }
 
@@ -43,21 +45,24 @@ pub trait Parse: Sized {
 /// example, an `RsvgLength` has an associated `type Data =
 /// LengthDir`, so to parse a length value, you could specify
 /// `LengthDir::Horizontal` for `data`, for example.
-pub fn parse<T>(key: &str,
-                value: &str,
-                data: <T as Parse>::Data,
-                validate: Option<fn(T) -> Result<T, AttributeError>>)
-                -> Result<T, NodeError>
-    where T: Parse<Err = AttributeError> + Copy
+pub fn parse<T>(
+    key: &str,
+    value: &str,
+    data: <T as Parse>::Data,
+    validate: Option<fn(T) -> Result<T, AttributeError>>,
+) -> Result<T, NodeError>
+where
+    T: Parse<Err = AttributeError> + Copy,
 {
-    T::parse(value, data).and_then(|v| {
-                                       if let Some(validate) = validate {
-                                           validate(v)
-                                       } else {
-                                           Ok(v)
-                                       }
-                                   })
-                         .map_err(|e| NodeError::attribute_error(key, e))
+    T::parse(value, data)
+        .and_then(|v| {
+            if let Some(validate) = validate {
+                validate(v)
+            } else {
+                Ok(v)
+            }
+        })
+        .map_err(|e| NodeError::attribute_error(key, e))
 }
 
 // angle:
@@ -72,13 +77,16 @@ pub fn angle_degrees(s: &str) -> Result<f64, ParseError> {
     let mut parser = Parser::new(&mut input);
 
     let angle = {
-        let token = parser.next()
-                          .map_err(|_| ParseError::new("expected angle"))?;
+        let token = parser
+            .next()
+            .map_err(|_| ParseError::new("expected angle"))?;
 
         match *token {
             Token::Number { value, .. } => f64::from(value),
 
-            Token::Dimension { value, ref unit, .. } => {
+            Token::Dimension {
+                value, ref unit, ..
+            } => {
                 let value = f64::from(value);
 
                 match unit.as_ref() {
@@ -93,8 +101,9 @@ pub fn angle_degrees(s: &str) -> Result<f64, ParseError> {
         }
     };
 
-    parser.expect_exhausted()
-          .map_err(|_| ParseError::new("expected angle"))?;
+    parser
+        .expect_exhausted()
+        .map_err(|_| ParseError::new("expected angle"))?;
 
     Ok(angle)
 }
@@ -132,10 +141,11 @@ pub fn number_optional_number(s: &str) -> Result<(f64, f64), ParseError> {
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_css_parse_number_optional_number(s: *const libc::c_char,
-                                                        out_x: *mut f64,
-                                                        out_y: *mut f64)
-                                                        -> glib_sys::gboolean {
+pub extern "C" fn rsvg_css_parse_number_optional_number(
+    s: *const libc::c_char,
+    out_x: *mut f64,
+    out_y: *mut f64,
+) -> glib_sys::gboolean {
     assert!(!s.is_null());
     assert!(!out_x.is_null());
     assert!(!out_y.is_null());
@@ -225,7 +235,9 @@ pub fn number_list(s: &str, length: ListLength) -> Result<Vec<f64>, NumberListEr
     let mut v = Vec::<f64>::with_capacity(n);
 
     for i in 0..n {
-        v.push (f64::from(parser.expect_number ().map_err (|_| NumberListError::Parse (ParseError::new 
("expected number")))?));
+        v.push(f64::from(parser.expect_number().map_err(|_| {
+            NumberListError::Parse(ParseError::new("expected number"))
+        })?));
 
         if i != n - 1 {
             optional_comma(&mut parser);
@@ -238,8 +250,9 @@ pub fn number_list(s: &str, length: ListLength) -> Result<Vec<f64>, NumberListEr
         }
     }
 
-    parser.expect_exhausted()
-          .map_err(|_| NumberListError::IncorrectNumberOfElements)?;
+    parser
+        .expect_exhausted()
+        .map_err(|_| NumberListError::IncorrectNumberOfElements)?;
 
     Ok(v)
 }
@@ -252,12 +265,13 @@ pub enum NumberListLength {
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_css_parse_number_list(in_str: *const libc::c_char,
-                                             nlength: NumberListLength,
-                                             size: libc::size_t,
-                                             out_list: *mut *const libc::c_double,
-                                             out_list_length: *mut libc::size_t)
-                                             -> glib_sys::gboolean {
+pub extern "C" fn rsvg_css_parse_number_list(
+    in_str: *const libc::c_char,
+    nlength: NumberListLength,
+    size: libc::size_t,
+    out_list: *mut *const libc::c_double,
+    out_list_length: *mut libc::size_t,
+) -> glib_sys::gboolean {
     assert!(!in_str.is_null());
     assert!(!out_list.is_null());
     assert!(!out_list_length.is_null());
@@ -277,7 +291,7 @@ pub extern "C" fn rsvg_css_parse_number_list(in_str: *const libc::c_char,
 
             let c_array = unsafe {
                 glib_sys::g_malloc_n(num_elems, mem::size_of::<libc::c_double>())
-                as *mut libc::c_double
+                    as *mut libc::c_double
             };
 
             let array = unsafe { slice::from_raw_parts_mut(c_array, num_elems) };
@@ -334,10 +348,14 @@ mod tests {
         assert_eq!(list_of_points("1 2 3 4"), Ok(vec![(1.0, 2.0), (3.0, 4.0)]));
         assert_eq!(list_of_points("1,2,3,4"), Ok(vec![(1.0, 2.0), (3.0, 4.0)]));
         assert_eq!(list_of_points("1,2 3,4"), Ok(vec![(1.0, 2.0), (3.0, 4.0)]));
-        assert_eq!(list_of_points("1,2 -3,4"),
-                   Ok(vec![(1.0, 2.0), (-3.0, 4.0)]));
-        assert_eq!(list_of_points("1,2,-3,4"),
-                   Ok(vec![(1.0, 2.0), (-3.0, 4.0)]));
+        assert_eq!(
+            list_of_points("1,2 -3,4"),
+            Ok(vec![(1.0, 2.0), (-3.0, 4.0)])
+        );
+        assert_eq!(
+            list_of_points("1,2,-3,4"),
+            Ok(vec![(1.0, 2.0), (-3.0, 4.0)])
+        );
     }
 
     #[test]
@@ -363,16 +381,22 @@ mod tests {
     fn parses_number_list() {
         assert_eq!(number_list("5", ListLength::Exact(1)), Ok(vec![5.0]));
 
-        assert_eq!(number_list("1 2 3 4", ListLength::Exact(4)),
-                   Ok(vec![1.0, 2.0, 3.0, 4.0]));
+        assert_eq!(
+            number_list("1 2 3 4", ListLength::Exact(4)),
+            Ok(vec![1.0, 2.0, 3.0, 4.0])
+        );
 
         assert_eq!(number_list("5", ListLength::Maximum(1)), Ok(vec![5.0]));
 
-        assert_eq!(number_list("1.0, -2.5", ListLength::Maximum(2)),
-                   Ok(vec![1.0, -2.5]));
+        assert_eq!(
+            number_list("1.0, -2.5", ListLength::Maximum(2)),
+            Ok(vec![1.0, -2.5])
+        );
 
-        assert_eq!(number_list("5 6", ListLength::Maximum(3)),
-                   Ok(vec![5.0, 6.0]));
+        assert_eq!(
+            number_list("5 6", ListLength::Maximum(3)),
+            Ok(vec![5.0, 6.0])
+        );
     }
 
     #[test]
diff --git a/rsvg_internals/src/path_builder.rs b/rsvg_internals/src/path_builder.rs
index f4ccfc24..b222b29c 100644
--- a/rsvg_internals/src/path_builder.rs
+++ b/rsvg_internals/src/path_builder.rs
@@ -30,7 +30,9 @@ pub struct RsvgPathBuilder {
 
 impl Default for RsvgPathBuilder {
     fn default() -> RsvgPathBuilder {
-        RsvgPathBuilder { path_commands: Vec::new(), }
+        RsvgPathBuilder {
+            path_commands: Vec::new(),
+        }
     }
 }
 
@@ -70,7 +72,8 @@ impl RsvgPathBuilder {
     }
 
     pub fn curve_to(&mut self, x2: f64, y2: f64, x3: f64, y3: f64, x4: f64, y4: f64) {
-        self.path_commands.push(PathCommand::CurveTo((x2, y2), (x3, y3), (x4, y4)));
+        self.path_commands
+            .push(PathCommand::CurveTo((x2, y2), (x3, y3), (x4, y4)));
     }
 
     pub fn close_path(&mut self) {
@@ -88,16 +91,18 @@ impl RsvgPathBuilder {
     // large_arc: false for arc length <= 180, true for arc >= 180
     // sweep: negative or positive angle
     // x2/y2: ending coordinates
-    pub fn arc(&mut self,
-               x1: f64,
-               y1: f64,
-               mut rx: f64,
-               mut ry: f64,
-               x_axis_rotation: f64,
-               large_arc: LargeArc,
-               sweep: Sweep,
-               x2: f64,
-               y2: f64) {
+    pub fn arc(
+        &mut self,
+        x1: f64,
+        y1: f64,
+        mut rx: f64,
+        mut ry: f64,
+        x_axis_rotation: f64,
+        large_arc: LargeArc,
+        sweep: Sweep,
+        x2: f64,
+        y2: f64,
+    ) {
         // See Appendix F.6 Elliptical arc implementation notes
         // http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes
         let f: f64;
@@ -213,24 +218,28 @@ impl RsvgPathBuilder {
         let n_segs_dbl = f64::from(n_segs);
 
         for i in 0..n_segs {
-            self.arc_segment(cx,
-                             cy,
-                             theta1 + f64::from(i) * delta_theta / n_segs_dbl,
-                             theta1 + f64::from(i + 1) * delta_theta / n_segs_dbl,
-                             rx,
-                             ry,
-                             x_axis_rotation);
+            self.arc_segment(
+                cx,
+                cy,
+                theta1 + f64::from(i) * delta_theta / n_segs_dbl,
+                theta1 + f64::from(i + 1) * delta_theta / n_segs_dbl,
+                rx,
+                ry,
+                x_axis_rotation,
+            );
         }
     }
 
-    fn arc_segment(&mut self,
-                   xc: f64,
-                   yc: f64,
-                   th0: f64,
-                   th1: f64,
-                   rx: f64,
-                   ry: f64,
-                   x_axis_rotation: f64) {
+    fn arc_segment(
+        &mut self,
+        xc: f64,
+        yc: f64,
+        th0: f64,
+        th1: f64,
+        rx: f64,
+        ry: f64,
+        x_axis_rotation: f64,
+    ) {
         let x1: f64;
         let y1: f64;
         let x2: f64;
@@ -256,12 +265,14 @@ impl RsvgPathBuilder {
         x2 = x3 + rx * (t * th1.sin());
         y2 = y3 + ry * (-t * th1.cos());
 
-        self.curve_to(xc + cosf * x1 - sinf * y1,
-                      yc + sinf * x1 + cosf * y1,
-                      xc + cosf * x2 - sinf * y2,
-                      yc + sinf * x2 + cosf * y2,
-                      xc + cosf * x3 - sinf * y3,
-                      yc + sinf * x3 + cosf * y3);
+        self.curve_to(
+            xc + cosf * x1 - sinf * y1,
+            yc + sinf * x1 + cosf * y1,
+            xc + cosf * x2 - sinf * y2,
+            yc + sinf * x2 + cosf * y2,
+            xc + cosf * x3 - sinf * y3,
+            yc + sinf * x3 + cosf * y3,
+        );
     }
 
     fn to_cairo(&self, cr: &cairo::Context) {
@@ -282,8 +293,10 @@ fn clamp(val: f64, low: f64, high: f64) -> f64 {
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_path_builder_add_to_cairo_context(raw_builder: *mut RsvgPathBuilder,
-                                                         raw_cr: *mut cairo_sys::cairo_t) {
+pub extern "C" fn rsvg_path_builder_add_to_cairo_context(
+    raw_builder: *mut RsvgPathBuilder,
+    raw_cr: *mut cairo_sys::cairo_t,
+) {
     assert!(!raw_builder.is_null());
     assert!(!raw_cr.is_null());
 
diff --git a/rsvg_internals/src/path_parser.rs b/rsvg_internals/src/path_parser.rs
index e87fa2e8..8c438e06 100644
--- a/rsvg_internals/src/path_parser.rs
+++ b/rsvg_internals/src/path_parser.rs
@@ -57,23 +57,25 @@ struct PathParser<'b> {
 //     M 0.1 -2 300 -4
 impl<'b> PathParser<'b> {
     fn new(builder: &'b mut RsvgPathBuilder, path_str: &'b str) -> PathParser<'b> {
-        PathParser { chars_enumerator: path_str.chars().enumerate(),
-                     lookahead: None,
-                     current_pos: None,
+        PathParser {
+            chars_enumerator: path_str.chars().enumerate(),
+            lookahead: None,
+            current_pos: None,
 
-                     builder,
+            builder,
 
-                     current_x: 0.0,
-                     current_y: 0.0,
+            current_x: 0.0,
+            current_y: 0.0,
 
-                     cubic_reflection_x: 0.0,
-                     cubic_reflection_y: 0.0,
+            cubic_reflection_x: 0.0,
+            cubic_reflection_y: 0.0,
 
-                     quadratic_reflection_x: 0.0,
-                     quadratic_reflection_y: 0.0,
+            quadratic_reflection_x: 0.0,
+            quadratic_reflection_y: 0.0,
 
-                     subpath_start_x: 0.0,
-                     subpath_start_y: 0.0, }
+            subpath_start_x: 0.0,
+            subpath_start_y: 0.0,
+        }
     }
 
     fn parse(&mut self) -> Result<(), ParseError> {
@@ -100,8 +102,10 @@ impl<'b> PathParser<'b> {
     }
 
     fn error(&self, kind: ErrorKind) -> ParseError {
-        ParseError { position: self.current_pos.unwrap(),
-                     kind, }
+        ParseError {
+            position: self.current_pos.unwrap(),
+            kind,
+        }
     }
 
     fn match_char(&mut self, c: char) -> bool {
@@ -172,7 +176,7 @@ impl<'b> PathParser<'b> {
     fn lookahead_is_start_of_number(&mut self) -> bool {
         let mut c = ' ';
         self.lookahead_is_digit(&mut c) || self.lookahead_is('.') || self.lookahead_is('+')
-        || self.lookahead_is('-')
+            || self.lookahead_is('-')
     }
 
     fn number(&mut self) -> Result<f64, ParseError> {
@@ -346,27 +350,31 @@ impl<'b> PathParser<'b> {
         self.builder.curve_to(x2, y2, x3, y3, x4, y4);
     }
 
-    fn emit_arc(&mut self,
-                rx: f64,
-                ry: f64,
-                x_axis_rotation: f64,
-                large_arc: LargeArc,
-                sweep: Sweep,
-                x: f64,
-                y: f64) {
+    fn emit_arc(
+        &mut self,
+        rx: f64,
+        ry: f64,
+        x_axis_rotation: f64,
+        large_arc: LargeArc,
+        sweep: Sweep,
+        x: f64,
+        y: f64,
+    ) {
         let (start_x, start_y) = (self.current_x, self.current_y);
 
         self.set_current_point(x, y);
 
-        self.builder.arc(start_x,
-                         start_y,
-                         rx,
-                         ry,
-                         x_axis_rotation,
-                         large_arc,
-                         sweep,
-                         self.current_x,
-                         self.current_y);
+        self.builder.arc(
+            start_x,
+            start_y,
+            rx,
+            ry,
+            x_axis_rotation,
+            large_arc,
+            sweep,
+            self.current_x,
+            self.current_y,
+        );
     }
 
     fn emit_close_path(&mut self) {
@@ -400,10 +408,11 @@ impl<'b> PathParser<'b> {
         Ok(())
     }
 
-    fn moveto_argument_sequence(&mut self,
-                                absolute: bool,
-                                is_initial_moveto: bool)
-                                -> Result<(), ParseError> {
+    fn moveto_argument_sequence(
+        &mut self,
+        absolute: bool,
+        is_initial_moveto: bool,
+    ) -> Result<(), ParseError> {
         let (mut x, mut y) = self.coordinate_pair()?;
 
         if is_initial_moveto {
@@ -480,10 +489,12 @@ impl<'b> PathParser<'b> {
     }
 
     fn drawto_command(&mut self) -> Result<bool, ParseError> {
-        Ok(self.close_path()? || self.line_to()? || self.horizontal_line_to()?
-           || self.vertical_line_to()? || self.curve_to()? || self.smooth_curve_to()?
-           || self.quadratic_bezier_curve_to()?
-           || self.smooth_quadratic_bezier_curve_to()? || self.elliptical_arc()?)
+        Ok(
+            self.close_path()? || self.line_to()? || self.horizontal_line_to()?
+                || self.vertical_line_to()? || self.curve_to()?
+                || self.smooth_curve_to()? || self.quadratic_bezier_curve_to()?
+                || self.smooth_quadratic_bezier_curve_to()? || self.elliptical_arc()?,
+        )
     }
 
     fn close_path(&mut self) -> Result<bool, ParseError> {
@@ -650,8 +661,10 @@ impl<'b> PathParser<'b> {
                 y4 += self.current_y;
             }
 
-            let (x2, y2) = (self.current_x + self.current_x - self.cubic_reflection_x,
-            self.current_y + self.current_y - self.cubic_reflection_y);
+            let (x2, y2) = (
+                self.current_x + self.current_x - self.cubic_reflection_x,
+                self.current_y + self.current_y - self.cubic_reflection_y,
+            );
 
             self.emit_curve_to(x2, y2, x3, y3, x4, y4);
 
@@ -752,9 +765,10 @@ impl<'b> PathParser<'b> {
         }
     }
 
-    fn smooth_quadratic_curveto_argument_sequence(&mut self,
-                                                  absolute: bool)
-                                                  -> Result<(), ParseError> {
+    fn smooth_quadratic_curveto_argument_sequence(
+        &mut self,
+        absolute: bool,
+    ) -> Result<(), ParseError> {
         loop {
             let (mut c, mut d) = self.coordinate_pair()?;
 
@@ -763,8 +777,10 @@ impl<'b> PathParser<'b> {
                 d += self.current_y;
             }
 
-            let (a, b) = (self.current_x + self.current_x - self.quadratic_reflection_x,
-            self.current_y + self.current_y - self.quadratic_reflection_y);
+            let (a, b) = (
+                self.current_x + self.current_x - self.quadratic_reflection_x,
+                self.current_y + self.current_y - self.quadratic_reflection_y,
+            );
 
             self.emit_quadratic_curve_to(a, b, c, d);
 
@@ -893,16 +909,19 @@ impl Error for ParseError {
 
 impl Display for ParseError {
     fn fmt(&self, f: &mut Formatter) -> fmt::Result {
-        write!(f,
-               "error at position {}: {}",
-               self.position,
-               self.description())
+        write!(
+            f,
+            "error at position {}: {}",
+            self.position,
+            self.description()
+        )
     }
 }
 
-pub fn parse_path_into_builder(path_str: &str,
-                               builder: &mut RsvgPathBuilder)
-                               -> Result<(), ParseError> {
+pub fn parse_path_into_builder(
+    path_str: &str,
+    builder: &mut RsvgPathBuilder,
+) -> Result<(), ParseError> {
     let mut parser = PathParser::new(builder, path_str);
 
     parser.parse()
@@ -916,22 +935,27 @@ mod tests {
         s.find('^')
     }
 
-    fn make_parse_result(error_pos_str: &str,
-                         error_kind: Option<ErrorKind>)
-                         -> Result<(), ParseError> {
+    fn make_parse_result(
+        error_pos_str: &str,
+        error_kind: Option<ErrorKind>,
+    ) -> Result<(), ParseError> {
         if let Some(pos) = find_error_pos(error_pos_str) {
-            Err(ParseError { position: pos,
-                             kind: error_kind.unwrap(), })
+            Err(ParseError {
+                position: pos,
+                kind: error_kind.unwrap(),
+            })
         } else {
             assert!(error_kind.is_none());
             Ok(())
         }
     }
 
-    fn test_parser(path_str: &str,
-                   error_pos_str: &str,
-                   expected_commands: &[PathCommand],
-                   expected_error_kind: Option<ErrorKind>) {
+    fn test_parser(
+        path_str: &str,
+        error_pos_str: &str,
+        expected_commands: &[PathCommand],
+        expected_error_kind: Option<ErrorKind>,
+    ) {
         let expected_result = make_parse_result(error_pos_str, expected_error_kind);
 
         let mut builder = RsvgPathBuilder::new();
@@ -961,10 +985,12 @@ mod tests {
 
     #[test]
     fn handles_empty_data() {
-        test_parser("",
-                    "^",
-                    &Vec::<PathCommand>::new(),
-                    Some(ErrorKind::UnexpectedEof));
+        test_parser(
+            "",
+            "^",
+            &Vec::<PathCommand>::new(),
+            Some(ErrorKind::UnexpectedEof),
+        );
     }
 
     #[test]
@@ -989,10 +1015,12 @@ mod tests {
 
         test_parser("M10.10E2 -0.20e3", "", &vec![moveto(1010.0, -200.0)], None);
 
-        test_parser("M-10.10E2-0.20e-3",
-                    "",
-                    &vec![moveto(-1010.0, -0.00020)],
-                    None);
+        test_parser(
+            "M-10.10E2-0.20e-3",
+            "",
+            &vec![moveto(-1010.0, -0.00020)],
+            None,
+        );
     }
 
     #[test]
@@ -1009,10 +1037,12 @@ mod tests {
 
         test_parser("M10e-", "     ^", &vec![], Some(ErrorKind::UnexpectedEof));
 
-        test_parser("M10e+x",
-                    "     ^",
-                    &vec![],
-                    Some(ErrorKind::UnexpectedToken));
+        test_parser(
+            "M10e+x",
+            "     ^",
+            &vec![],
+            Some(ErrorKind::UnexpectedToken),
+        );
     }
 
     #[test]
@@ -1035,10 +1065,12 @@ mod tests {
 
         test_parser("M10.10E2,-0.20e3", "", &vec![moveto(1010.0, -200.0)], None);
 
-        test_parser("M-10.10E2,-0.20e-3",
-                    "",
-                    &vec![moveto(-1010.0, -0.00020)],
-                    None);
+        test_parser(
+            "M-10.10E2,-0.20e-3",
+            "",
+            &vec![moveto(-1010.0, -0.00020)],
+            None,
+        );
     }
 
     #[test]
@@ -1059,303 +1091,423 @@ mod tests {
 
     #[test]
     fn handles_absolute_moveto_with_implicit_lineto() {
-        test_parser("M10 20 30 40",
-                    "",
-                    &vec![moveto(10.0, 20.0), lineto(30.0, 40.0)],
-                    None);
-
-        test_parser("M10,20,30,40",
-                    "",
-                    &vec![moveto(10.0, 20.0), lineto(30.0, 40.0)],
-                    None);
-
-        test_parser("M.1-2,3E2-4",
-                    "",
-                    &vec![moveto(0.1, -2.0), lineto(300.0, -4.0)],
-                    None);
+        test_parser(
+            "M10 20 30 40",
+            "",
+            &vec![moveto(10.0, 20.0), lineto(30.0, 40.0)],
+            None,
+        );
+
+        test_parser(
+            "M10,20,30,40",
+            "",
+            &vec![moveto(10.0, 20.0), lineto(30.0, 40.0)],
+            None,
+        );
+
+        test_parser(
+            "M.1-2,3E2-4",
+            "",
+            &vec![moveto(0.1, -2.0), lineto(300.0, -4.0)],
+            None,
+        );
     }
 
     #[test]
     fn handles_relative_moveto_with_implicit_lineto() {
-        test_parser("m10 20 30 40",
-                    "",
-                    &vec![moveto(10.0, 20.0), lineto(40.0, 60.0)],
-                    None);
+        test_parser(
+            "m10 20 30 40",
+            "",
+            &vec![moveto(10.0, 20.0), lineto(40.0, 60.0)],
+            None,
+        );
     }
 
     #[test]
     fn handles_absolute_moveto_with_implicit_linetos() {
-        test_parser("M10,20 30,40,50 60",
-                    "",
-                    &vec![moveto(10.0, 20.0), lineto(30.0, 40.0), lineto(50.0, 60.0)],
-                    None);
+        test_parser(
+            "M10,20 30,40,50 60",
+            "",
+            &vec![moveto(10.0, 20.0), lineto(30.0, 40.0), lineto(50.0, 60.0)],
+            None,
+        );
     }
 
     #[test]
     fn handles_relative_moveto_with_implicit_linetos() {
-        test_parser("m10 20 30 40 50 60",
-                    "",
-                    &vec![moveto(10.0, 20.0), lineto(40.0, 60.0), lineto(90.0, 120.0)],
-                    None);
+        test_parser(
+            "m10 20 30 40 50 60",
+            "",
+            &vec![moveto(10.0, 20.0), lineto(40.0, 60.0), lineto(90.0, 120.0)],
+            None,
+        );
     }
 
     #[test]
     fn handles_absolute_moveto_moveto() {
-        test_parser("M10 20 M 30 40",
-                    "",
-                    &vec![moveto(10.0, 20.0), moveto(30.0, 40.0)],
-                    None);
+        test_parser(
+            "M10 20 M 30 40",
+            "",
+            &vec![moveto(10.0, 20.0), moveto(30.0, 40.0)],
+            None,
+        );
     }
 
     #[test]
     fn handles_relative_moveto_moveto() {
-        test_parser("m10 20 m 30 40",
-                    "",
-                    &vec![moveto(10.0, 20.0), moveto(40.0, 60.0)],
-                    None);
+        test_parser(
+            "m10 20 m 30 40",
+            "",
+            &vec![moveto(10.0, 20.0), moveto(40.0, 60.0)],
+            None,
+        );
     }
 
     #[test]
     fn handles_relative_moveto_lineto_moveto() {
-        test_parser("m10 20 30 40 m 50 60",
-                    "",
-                    &vec![moveto(10.0, 20.0), lineto(40.0, 60.0), moveto(90.0, 120.0)],
-                    None);
+        test_parser(
+            "m10 20 30 40 m 50 60",
+            "",
+            &vec![moveto(10.0, 20.0), lineto(40.0, 60.0), moveto(90.0, 120.0)],
+            None,
+        );
     }
 
     #[test]
     fn handles_absolute_moveto_lineto() {
-        test_parser("M10 20 L30,40",
-                    "",
-                    &vec![moveto(10.0, 20.0), lineto(30.0, 40.0)],
-                    None);
+        test_parser(
+            "M10 20 L30,40",
+            "",
+            &vec![moveto(10.0, 20.0), lineto(30.0, 40.0)],
+            None,
+        );
     }
 
     #[test]
     fn handles_relative_moveto_lineto() {
-        test_parser("m10 20 l30,40",
-                    "",
-                    &vec![moveto(10.0, 20.0), lineto(40.0, 60.0)],
-                    None);
+        test_parser(
+            "m10 20 l30,40",
+            "",
+            &vec![moveto(10.0, 20.0), lineto(40.0, 60.0)],
+            None,
+        );
     }
 
     #[test]
     fn handles_relative_moveto_lineto_lineto_abs_lineto() {
-        test_parser("m10 20 30 40l30,40,50 60L200,300",
-                    "",
-                    &vec![moveto(10.0, 20.0),
-                          lineto(40.0, 60.0),
-                          lineto(70.0, 100.0),
-                          lineto(120.0, 160.0),
-                          lineto(200.0, 300.0)],
-                    None);
+        test_parser(
+            "m10 20 30 40l30,40,50 60L200,300",
+            "",
+            &vec![
+                moveto(10.0, 20.0),
+                lineto(40.0, 60.0),
+                lineto(70.0, 100.0),
+                lineto(120.0, 160.0),
+                lineto(200.0, 300.0),
+            ],
+            None,
+        );
     }
 
     #[test]
     fn handles_horizontal_lineto() {
-        test_parser("M10 20 H30",
-                    "",
-                    &vec![moveto(10.0, 20.0), lineto(30.0, 20.0)],
-                    None);
-
-        test_parser("M10 20 H30 40",
-                    "",
-                    &vec![moveto(10.0, 20.0), lineto(30.0, 20.0), lineto(40.0, 20.0)],
-                    None);
-
-        test_parser("M10 20 H30,40-50",
-                    "",
-                    &vec![moveto(10.0, 20.0),
-                          lineto(30.0, 20.0),
-                          lineto(40.0, 20.0),
-                          lineto(-50.0, 20.0)],
-                    None);
-
-        test_parser("m10 20 h30,40-50",
-                    "",
-                    &vec![moveto(10.0, 20.0),
-                          lineto(40.0, 20.0),
-                          lineto(80.0, 20.0),
-                          lineto(30.0, 20.0)],
-                    None);
+        test_parser(
+            "M10 20 H30",
+            "",
+            &vec![moveto(10.0, 20.0), lineto(30.0, 20.0)],
+            None,
+        );
+
+        test_parser(
+            "M10 20 H30 40",
+            "",
+            &vec![moveto(10.0, 20.0), lineto(30.0, 20.0), lineto(40.0, 20.0)],
+            None,
+        );
+
+        test_parser(
+            "M10 20 H30,40-50",
+            "",
+            &vec![
+                moveto(10.0, 20.0),
+                lineto(30.0, 20.0),
+                lineto(40.0, 20.0),
+                lineto(-50.0, 20.0),
+            ],
+            None,
+        );
+
+        test_parser(
+            "m10 20 h30,40-50",
+            "",
+            &vec![
+                moveto(10.0, 20.0),
+                lineto(40.0, 20.0),
+                lineto(80.0, 20.0),
+                lineto(30.0, 20.0),
+            ],
+            None,
+        );
     }
 
     #[test]
     fn handles_vertical_lineto() {
-        test_parser("M10 20 V30",
-                    "",
-                    &vec![moveto(10.0, 20.0), lineto(10.0, 30.0)],
-                    None);
-
-        test_parser("M10 20 V30 40",
-                    "",
-                    &vec![moveto(10.0, 20.0), lineto(10.0, 30.0), lineto(10.0, 40.0)],
-                    None);
-
-        test_parser("M10 20 V30,40-50",
-                    "",
-                    &vec![moveto(10.0, 20.0),
-                          lineto(10.0, 30.0),
-                          lineto(10.0, 40.0),
-                          lineto(10.0, -50.0)],
-                    None);
-
-        test_parser("m10 20 v30,40-50",
-                    "",
-                    &vec![moveto(10.0, 20.0),
-                          lineto(10.0, 50.0),
-                          lineto(10.0, 90.0),
-                          lineto(10.0, 40.0)],
-                    None);
+        test_parser(
+            "M10 20 V30",
+            "",
+            &vec![moveto(10.0, 20.0), lineto(10.0, 30.0)],
+            None,
+        );
+
+        test_parser(
+            "M10 20 V30 40",
+            "",
+            &vec![moveto(10.0, 20.0), lineto(10.0, 30.0), lineto(10.0, 40.0)],
+            None,
+        );
+
+        test_parser(
+            "M10 20 V30,40-50",
+            "",
+            &vec![
+                moveto(10.0, 20.0),
+                lineto(10.0, 30.0),
+                lineto(10.0, 40.0),
+                lineto(10.0, -50.0),
+            ],
+            None,
+        );
+
+        test_parser(
+            "m10 20 v30,40-50",
+            "",
+            &vec![
+                moveto(10.0, 20.0),
+                lineto(10.0, 50.0),
+                lineto(10.0, 90.0),
+                lineto(10.0, 40.0),
+            ],
+            None,
+        );
     }
 
     #[test]
     fn handles_curveto() {
-        test_parser("M10 20 C 30,40 50 60-70,80",
-                    "",
-                    &vec![moveto(10.0, 20.0),
-                          curveto(30.0, 40.0, 50.0, 60.0, -70.0, 80.0)],
-                    None);
-
-        test_parser("M10 20 C 30,40 50 60-70,80,90 100,110 120,130,140",
-                    "",
-                    &vec![moveto(10.0, 20.0),
-                          curveto(30.0, 40.0, 50.0, 60.0, -70.0, 80.0),
-                          curveto(90.0, 100.0, 110.0, 120.0, 130.0, 140.0)],
-                    None);
-
-        test_parser("m10 20 c 30,40 50 60-70,80,90 100,110 120,130,140",
-                    "",
-                    &vec![moveto(10.0, 20.0),
-                          curveto(40.0, 60.0, 60.0, 80.0, -60.0, 100.0),
-                          curveto(30.0, 200.0, 50.0, 220.0, 70.0, 240.0)],
-                    None);
-
-        test_parser("m10 20 c 30,40 50 60-70,80,90 100,110 120,130,140",
-                    "",
-                    &vec![moveto(10.0, 20.0),
-                          curveto(40.0, 60.0, 60.0, 80.0, -60.0, 100.0),
-                          curveto(30.0, 200.0, 50.0, 220.0, 70.0, 240.0)],
-                    None);
+        test_parser(
+            "M10 20 C 30,40 50 60-70,80",
+            "",
+            &vec![
+                moveto(10.0, 20.0),
+                curveto(30.0, 40.0, 50.0, 60.0, -70.0, 80.0),
+            ],
+            None,
+        );
+
+        test_parser(
+            "M10 20 C 30,40 50 60-70,80,90 100,110 120,130,140",
+            "",
+            &vec![
+                moveto(10.0, 20.0),
+                curveto(30.0, 40.0, 50.0, 60.0, -70.0, 80.0),
+                curveto(90.0, 100.0, 110.0, 120.0, 130.0, 140.0),
+            ],
+            None,
+        );
+
+        test_parser(
+            "m10 20 c 30,40 50 60-70,80,90 100,110 120,130,140",
+            "",
+            &vec![
+                moveto(10.0, 20.0),
+                curveto(40.0, 60.0, 60.0, 80.0, -60.0, 100.0),
+                curveto(30.0, 200.0, 50.0, 220.0, 70.0, 240.0),
+            ],
+            None,
+        );
+
+        test_parser(
+            "m10 20 c 30,40 50 60-70,80,90 100,110 120,130,140",
+            "",
+            &vec![
+                moveto(10.0, 20.0),
+                curveto(40.0, 60.0, 60.0, 80.0, -60.0, 100.0),
+                curveto(30.0, 200.0, 50.0, 220.0, 70.0, 240.0),
+            ],
+            None,
+        );
     }
 
     #[test]
     fn handles_smooth_curveto() {
-        test_parser("M10 20 S 30,40-50,60",
-                    "",
-                    &vec![moveto(10.0, 20.0),
-                          curveto(10.0, 20.0, 30.0, 40.0, -50.0, 60.0)],
-                    None);
-
-        test_parser("M10 20 S 30,40 50 60-70,80,90 100",
-                    "",
-                    &vec![moveto(10.0, 20.0),
-                          curveto(10.0, 20.0, 30.0, 40.0, 50.0, 60.0),
-                          curveto(70.0, 80.0, -70.0, 80.0, 90.0, 100.0)],
-                    None);
-
-        test_parser("m10 20 s 30,40 50 60-70,80,90 100",
-                    "",
-                    &vec![moveto(10.0, 20.0),
-                          curveto(10.0, 20.0, 40.0, 60.0, 60.0, 80.0),
-                          curveto(80.0, 100.0, -10.0, 160.0, 150.0, 180.0)],
-                    None);
+        test_parser(
+            "M10 20 S 30,40-50,60",
+            "",
+            &vec![
+                moveto(10.0, 20.0),
+                curveto(10.0, 20.0, 30.0, 40.0, -50.0, 60.0),
+            ],
+            None,
+        );
+
+        test_parser(
+            "M10 20 S 30,40 50 60-70,80,90 100",
+            "",
+            &vec![
+                moveto(10.0, 20.0),
+                curveto(10.0, 20.0, 30.0, 40.0, 50.0, 60.0),
+                curveto(70.0, 80.0, -70.0, 80.0, 90.0, 100.0),
+            ],
+            None,
+        );
+
+        test_parser(
+            "m10 20 s 30,40 50 60-70,80,90 100",
+            "",
+            &vec![
+                moveto(10.0, 20.0),
+                curveto(10.0, 20.0, 40.0, 60.0, 60.0, 80.0),
+                curveto(80.0, 100.0, -10.0, 160.0, 150.0, 180.0),
+            ],
+            None,
+        );
     }
 
     #[test]
     fn handles_quadratic_curveto() {
-        test_parser("M10 20 Q30 40 50 60",
-                    "",
-                    &vec![moveto(10.0, 20.0),
-                          curveto(70.0 / 3.0,
-                                  100.0 / 3.0,
-                                  110.0 / 3.0,
-                                  140.0 / 3.0,
-                                  50.0,
-                                  60.0)],
-                    None);
-
-        test_parser("M10 20 Q30 40 50 60,70,80-90 100",
-                    "",
-                    &vec![moveto(10.0, 20.0),
-                          curveto(70.0 / 3.0,
-                                  100.0 / 3.0,
-                                  110.0 / 3.0,
-                                  140.0 / 3.0,
-                                  50.0,
-                                  60.0),
-                          curveto(190.0 / 3.0,
-                                  220.0 / 3.0,
-                                  50.0 / 3.0,
-                                  260.0 / 3.0,
-                                  -90.0,
-                                  100.0)],
-                    None);
-
-        test_parser("m10 20 q 30,40 50 60-70,80 90 100",
-                    "",
-                    &vec![moveto(10.0, 20.0),
-                          curveto(90.0 / 3.0,
-                                  140.0 / 3.0,
-                                  140.0 / 3.0,
-                                  200.0 / 3.0,
-                                  60.0,
-                                  80.0),
-                          curveto(40.0 / 3.0,
-                                  400.0 / 3.0,
-                                  130.0 / 3.0,
-                                  500.0 / 3.0,
-                                  150.0,
-                                  180.0)],
-                    None);
+        test_parser(
+            "M10 20 Q30 40 50 60",
+            "",
+            &vec![
+                moveto(10.0, 20.0),
+                curveto(
+                    70.0 / 3.0,
+                    100.0 / 3.0,
+                    110.0 / 3.0,
+                    140.0 / 3.0,
+                    50.0,
+                    60.0,
+                ),
+            ],
+            None,
+        );
+
+        test_parser(
+            "M10 20 Q30 40 50 60,70,80-90 100",
+            "",
+            &vec![
+                moveto(10.0, 20.0),
+                curveto(
+                    70.0 / 3.0,
+                    100.0 / 3.0,
+                    110.0 / 3.0,
+                    140.0 / 3.0,
+                    50.0,
+                    60.0,
+                ),
+                curveto(
+                    190.0 / 3.0,
+                    220.0 / 3.0,
+                    50.0 / 3.0,
+                    260.0 / 3.0,
+                    -90.0,
+                    100.0,
+                ),
+            ],
+            None,
+        );
+
+        test_parser(
+            "m10 20 q 30,40 50 60-70,80 90 100",
+            "",
+            &vec![
+                moveto(10.0, 20.0),
+                curveto(
+                    90.0 / 3.0,
+                    140.0 / 3.0,
+                    140.0 / 3.0,
+                    200.0 / 3.0,
+                    60.0,
+                    80.0,
+                ),
+                curveto(
+                    40.0 / 3.0,
+                    400.0 / 3.0,
+                    130.0 / 3.0,
+                    500.0 / 3.0,
+                    150.0,
+                    180.0,
+                ),
+            ],
+            None,
+        );
     }
 
     #[test]
     fn handles_smooth_quadratic_curveto() {
-        test_parser("M10 20 T30 40",
-                    "",
-                    &vec![moveto(10.0, 20.0),
-                          curveto(10.0, 20.0, 50.0 / 3.0, 80.0 / 3.0, 30.0, 40.0)],
-                    None);
-
-        test_parser("M10 20 Q30 40 50 60 T70 80",
-                    "",
-                    &vec![moveto(10.0, 20.0),
-                          curveto(70.0 / 3.0,
-                                  100.0 / 3.0,
-                                  110.0 / 3.0,
-                                  140.0 / 3.0,
-                                  50.0,
-                                  60.0),
-                          curveto(190.0 / 3.0, 220.0 / 3.0, 70.0, 80.0, 70.0, 80.0)],
-                    None);
-
-        test_parser("m10 20 q 30,40 50 60t-70,80",
-                    "",
-                    &vec![moveto(10.0, 20.0),
-                          curveto(90.0 / 3.0,
-                                  140.0 / 3.0,
-                                  140.0 / 3.0,
-                                  200.0 / 3.0,
-                                  60.0,
-                                  80.0),
-                          curveto(220.0 / 3.0, 280.0 / 3.0, 50.0, 120.0, -10.0, 160.0)],
-                    None);
+        test_parser(
+            "M10 20 T30 40",
+            "",
+            &vec![
+                moveto(10.0, 20.0),
+                curveto(10.0, 20.0, 50.0 / 3.0, 80.0 / 3.0, 30.0, 40.0),
+            ],
+            None,
+        );
+
+        test_parser(
+            "M10 20 Q30 40 50 60 T70 80",
+            "",
+            &vec![
+                moveto(10.0, 20.0),
+                curveto(
+                    70.0 / 3.0,
+                    100.0 / 3.0,
+                    110.0 / 3.0,
+                    140.0 / 3.0,
+                    50.0,
+                    60.0,
+                ),
+                curveto(190.0 / 3.0, 220.0 / 3.0, 70.0, 80.0, 70.0, 80.0),
+            ],
+            None,
+        );
+
+        test_parser(
+            "m10 20 q 30,40 50 60t-70,80",
+            "",
+            &vec![
+                moveto(10.0, 20.0),
+                curveto(
+                    90.0 / 3.0,
+                    140.0 / 3.0,
+                    140.0 / 3.0,
+                    200.0 / 3.0,
+                    60.0,
+                    80.0,
+                ),
+                curveto(220.0 / 3.0, 280.0 / 3.0, 50.0, 120.0, -10.0, 160.0),
+            ],
+            None,
+        );
     }
 
     #[test]
     fn handles_close_path() {
         test_parser("M10 20 Z", "", &vec![moveto(10.0, 20.0), closepath()], None);
 
-        test_parser("m10 20 30 40 m 50 60 70 80 90 100z",
-                    "",
-                    &vec![moveto(10.0, 20.0),
-                          lineto(40.0, 60.0),
-                          moveto(90.0, 120.0),
-                          lineto(160.0, 200.0),
-                          lineto(250.0, 300.0),
-                          closepath()],
-                    None);
+        test_parser(
+            "m10 20 30 40 m 50 60 70 80 90 100z",
+            "",
+            &vec![
+                moveto(10.0, 20.0),
+                lineto(40.0, 60.0),
+                moveto(90.0, 120.0),
+                lineto(160.0, 200.0),
+                lineto(250.0, 300.0),
+                closepath(),
+            ],
+            None,
+        );
     }
 
     // FIXME: we don't have a handles_arc() because
@@ -1384,322 +1536,452 @@ mod tests {
 
     #[test]
     fn moveto_implicit_lineto_args() {
-        test_parser("M10-20,",
-                    "       ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10-20-30",
-                    "         ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10-20-30 x",
-                    "          ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedToken));
+        test_parser(
+            "M10-20,",
+            "       ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10-20-30",
+            "         ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10-20-30 x",
+            "          ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedToken),
+        );
     }
 
     #[test]
     fn closepath_no_args() {
-        test_parser("M10-20z10",
-                    "       ^",
-                    &vec![moveto(10.0, -20.0), closepath()],
-                    Some(ErrorKind::UnexpectedToken));
+        test_parser(
+            "M10-20z10",
+            "       ^",
+            &vec![moveto(10.0, -20.0), closepath()],
+            Some(ErrorKind::UnexpectedToken),
+        );
 
-        test_parser("M10-20z,",
-                    "       ^",
-                    &vec![moveto(10.0, -20.0), closepath()],
-                    Some(ErrorKind::UnexpectedToken));
+        test_parser(
+            "M10-20z,",
+            "       ^",
+            &vec![moveto(10.0, -20.0), closepath()],
+            Some(ErrorKind::UnexpectedToken),
+        );
     }
 
     #[test]
     fn lineto_args() {
-        test_parser("M10-20L10",
-                    "         ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M 10,10 L 20,20,30",
-                    "                  ^",
-                    &vec![moveto(10.0, 10.0), lineto(20.0, 20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M 10,10 L 20,20,",
-                    "                ^",
-                    &vec![moveto(10.0, 10.0), lineto(20.0, 20.0)],
-                    Some(ErrorKind::UnexpectedEof));
+        test_parser(
+            "M10-20L10",
+            "         ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M 10,10 L 20,20,30",
+            "                  ^",
+            &vec![moveto(10.0, 10.0), lineto(20.0, 20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M 10,10 L 20,20,",
+            "                ^",
+            &vec![moveto(10.0, 10.0), lineto(20.0, 20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
     }
 
     #[test]
     fn horizontal_lineto_args() {
-        test_parser("M10-20H",
-                    "       ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10-20H,",
-                    "       ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedToken));
-
-        test_parser("M10-20H30,",
-                    "          ^",
-                    &vec![moveto(10.0, -20.0), lineto(30.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
+        test_parser(
+            "M10-20H",
+            "       ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10-20H,",
+            "       ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedToken),
+        );
+
+        test_parser(
+            "M10-20H30,",
+            "          ^",
+            &vec![moveto(10.0, -20.0), lineto(30.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
     }
 
     #[test]
     fn vertical_lineto_args() {
-        test_parser("M10-20v",
-                    "       ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10-20v,",
-                    "       ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedToken));
-
-        test_parser("M10-20v30,",
-                    "          ^",
-                    &vec![moveto(10.0, -20.0), lineto(10.0, 10.0)],
-                    Some(ErrorKind::UnexpectedEof));
+        test_parser(
+            "M10-20v",
+            "       ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10-20v,",
+            "       ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedToken),
+        );
+
+        test_parser(
+            "M10-20v30,",
+            "          ^",
+            &vec![moveto(10.0, -20.0), lineto(10.0, 10.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
     }
 
     #[test]
     fn curveto_args() {
-        test_parser("M10-20C1",
-                    "        ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20C1,",
-                    "         ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10-20C1 2",
-                    "          ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20C1,2,",
-                    "           ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10-20C1 2 3",
-                    "            ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20C1,2,3",
-                    "            ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20C1,2,3,",
-                    "             ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10-20C1 2 3 4",
-                    "              ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20C1,2,3,4",
-                    "              ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20C1,2,3,4,",
-                    "               ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10-20C1 2 3 4 5",
-                    "                ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20C1,2,3,4,5",
-                    "                ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20C1,2,3,4,5,",
-                    "                 ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10-20C1,2,3,4,5,6,",
-                    "                   ^",
-                    &vec![moveto(10.0, -20.0), curveto(1.0, 2.0, 3.0, 4.0, 5.0, 6.0)],
-                    Some(ErrorKind::UnexpectedEof));
+        test_parser(
+            "M10-20C1",
+            "        ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20C1,",
+            "         ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10-20C1 2",
+            "          ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20C1,2,",
+            "           ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10-20C1 2 3",
+            "            ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20C1,2,3",
+            "            ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20C1,2,3,",
+            "             ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10-20C1 2 3 4",
+            "              ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20C1,2,3,4",
+            "              ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20C1,2,3,4,",
+            "               ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10-20C1 2 3 4 5",
+            "                ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20C1,2,3,4,5",
+            "                ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20C1,2,3,4,5,",
+            "                 ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10-20C1,2,3,4,5,6,",
+            "                   ^",
+            &vec![moveto(10.0, -20.0), curveto(1.0, 2.0, 3.0, 4.0, 5.0, 6.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
     }
 
     #[test]
     fn smooth_curveto_args() {
-        test_parser("M10-20S1",
-                    "        ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20S1,",
-                    "         ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10-20S1 2",
-                    "          ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20S1,2,",
-                    "           ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10-20S1 2 3",
-                    "            ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20S1,2,3",
-                    "            ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20S1,2,3,",
-                    "             ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10-20S1,2,3,4,",
-                    "               ^",
-                    &vec![moveto(10.0, -20.0),
-                          curveto(10.0, -20.0, 1.0, 2.0, 3.0, 4.0)],
-                    Some(ErrorKind::UnexpectedEof));
+        test_parser(
+            "M10-20S1",
+            "        ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20S1,",
+            "         ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10-20S1 2",
+            "          ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20S1,2,",
+            "           ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10-20S1 2 3",
+            "            ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20S1,2,3",
+            "            ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20S1,2,3,",
+            "             ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10-20S1,2,3,4,",
+            "               ^",
+            &vec![
+                moveto(10.0, -20.0),
+                curveto(10.0, -20.0, 1.0, 2.0, 3.0, 4.0),
+            ],
+            Some(ErrorKind::UnexpectedEof),
+        );
     }
 
     #[test]
     fn quadratic_bezier_curveto_args() {
-        test_parser("M10-20Q1",
-                    "        ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20Q1,",
-                    "         ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10-20Q1 2",
-                    "          ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20Q1,2,",
-                    "           ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10-20Q1 2 3",
-                    "            ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20Q1,2,3",
-                    "            ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20Q1,2,3,",
-                    "             ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10 20 Q30 40 50 60,",
-                    "                    ^",
-                    &vec![moveto(10.0, 20.0),
-                          curveto(70.0 / 3.0,
-                                  100.0 / 3.0,
-                                  110.0 / 3.0,
-                                  140.0 / 3.0,
-                                  50.0,
-                                  60.0)],
-                    Some(ErrorKind::UnexpectedEof));
+        test_parser(
+            "M10-20Q1",
+            "        ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20Q1,",
+            "         ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10-20Q1 2",
+            "          ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20Q1,2,",
+            "           ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10-20Q1 2 3",
+            "            ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20Q1,2,3",
+            "            ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20Q1,2,3,",
+            "             ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10 20 Q30 40 50 60,",
+            "                    ^",
+            &vec![
+                moveto(10.0, 20.0),
+                curveto(
+                    70.0 / 3.0,
+                    100.0 / 3.0,
+                    110.0 / 3.0,
+                    140.0 / 3.0,
+                    50.0,
+                    60.0,
+                ),
+            ],
+            Some(ErrorKind::UnexpectedEof),
+        );
     }
 
     #[test]
     fn smooth_quadratic_bezier_curveto_args() {
-        test_parser("M10-20T1",
-                    "        ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20T1,",
-                    "         ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10 20 T30 40,",
-                    "              ^",
-                    &vec![moveto(10.0, 20.0),
-                          curveto(10.0, 20.0, 50.0 / 3.0, 80.0 / 3.0, 30.0, 40.0)],
-                    Some(ErrorKind::UnexpectedEof));
+        test_parser(
+            "M10-20T1",
+            "        ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20T1,",
+            "         ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10 20 T30 40,",
+            "              ^",
+            &vec![
+                moveto(10.0, 20.0),
+                curveto(10.0, 20.0, 50.0 / 3.0, 80.0 / 3.0, 30.0, 40.0),
+            ],
+            Some(ErrorKind::UnexpectedEof),
+        );
     }
 
     #[test]
     fn elliptical_arc_args() {
-        test_parser("M10-20A1",
-                    "        ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20A1,",
-                    "         ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10-20A1 2",
-                    "          ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20A1 2,",
-                    "           ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10-20A1 2 3",
-                    "            ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20A1 2 3,",
-                    "             ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10-20A1 2 3 4",
-                    "             ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedToken));
-
-        test_parser("M10-20A1 2 3 1",
-                    "              ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20A1 2 3,1,",
-                    "               ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10-20A1 2 3 1 5",
-                    "               ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedToken));
-
-        test_parser("M10-20A1 2 3 1 1",
-                    "                ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20A1 2 3,1,1,",
-                    "                 ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-
-        test_parser("M10-20A1 2 3 1 1 6",
-                    "                  ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
-        test_parser("M10-20A1 2 3,1,1,6,",
-                    "                   ^",
-                    &vec![moveto(10.0, -20.0)],
-                    Some(ErrorKind::UnexpectedEof));
+        test_parser(
+            "M10-20A1",
+            "        ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20A1,",
+            "         ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10-20A1 2",
+            "          ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20A1 2,",
+            "           ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10-20A1 2 3",
+            "            ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20A1 2 3,",
+            "             ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10-20A1 2 3 4",
+            "             ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedToken),
+        );
+
+        test_parser(
+            "M10-20A1 2 3 1",
+            "              ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20A1 2 3,1,",
+            "               ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10-20A1 2 3 1 5",
+            "               ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedToken),
+        );
+
+        test_parser(
+            "M10-20A1 2 3 1 1",
+            "                ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20A1 2 3,1,1,",
+            "                 ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+
+        test_parser(
+            "M10-20A1 2 3 1 1 6",
+            "                  ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
+        test_parser(
+            "M10-20A1 2 3,1,1,6,",
+            "                   ^",
+            &vec![moveto(10.0, -20.0)],
+            Some(ErrorKind::UnexpectedEof),
+        );
 
         // FIXME: we don't test the arc results, because
         // we don't know what segments will be computed by PathBuilder::arc().
diff --git a/rsvg_internals/src/pattern.rs b/rsvg_internals/src/pattern.rs
index 04afc8ff..32625165 100644
--- a/rsvg_internals/src/pattern.rs
+++ b/rsvg_internals/src/pattern.rs
@@ -49,17 +49,19 @@ impl Default for Pattern {
     fn default() -> Pattern {
         // These are per the spec
 
-        Pattern { units: Some(PatternUnits::default()),
-                  content_units: Some(PatternContentUnits::default()),
-                  vbox: Some(None),
-                  preserve_aspect_ratio: Some(AspectRatio::default()),
-                  affine: Some(cairo::Matrix::identity()),
-                  fallback: None,
-                  x: Some(RsvgLength::default()),
-                  y: Some(RsvgLength::default()),
-                  width: Some(RsvgLength::default()),
-                  height: Some(RsvgLength::default()),
-                  node: None, }
+        Pattern {
+            units: Some(PatternUnits::default()),
+            content_units: Some(PatternContentUnits::default()),
+            vbox: Some(None),
+            preserve_aspect_ratio: Some(AspectRatio::default()),
+            affine: Some(cairo::Matrix::identity()),
+            fallback: None,
+            x: Some(RsvgLength::default()),
+            y: Some(RsvgLength::default()),
+            width: Some(RsvgLength::default()),
+            height: Some(RsvgLength::default()),
+            node: None,
+        }
     }
 }
 
@@ -99,24 +101,26 @@ macro_rules! fallback_to (
 
 impl Pattern {
     fn unresolved() -> Pattern {
-        Pattern { units: None,
-                  content_units: None,
-                  vbox: None,
-                  preserve_aspect_ratio: None,
-                  affine: None,
-                  fallback: None,
-                  x: None,
-                  y: None,
-                  width: None,
-                  height: None,
-                  node: None, }
+        Pattern {
+            units: None,
+            content_units: None,
+            vbox: None,
+            preserve_aspect_ratio: None,
+            affine: None,
+            fallback: None,
+            x: None,
+            y: None,
+            width: None,
+            height: None,
+            node: None,
+        }
     }
 
     fn is_resolved(&self) -> bool {
         self.units.is_some() && self.content_units.is_some() && self.vbox.is_some()
-        && self.preserve_aspect_ratio.is_some() && self.affine.is_some() && self.x.is_some()
-        && self.y.is_some() && self.width.is_some() && self.height.is_some()
-        && node_has_children(&self.node)
+            && self.preserve_aspect_ratio.is_some() && self.affine.is_some()
+            && self.x.is_some() && self.y.is_some() && self.width.is_some()
+            && self.height.is_some() && node_has_children(&self.node)
     }
 
     fn resolve_from_defaults(&mut self) {
@@ -152,7 +156,9 @@ struct NodePattern {
 
 impl NodePattern {
     fn new() -> NodePattern {
-        NodePattern { pattern: RefCell::new(Pattern::unresolved()), }
+        NodePattern {
+            pattern: RefCell::new(Pattern::unresolved()),
+        }
     }
 }
 
@@ -187,17 +193,21 @@ impl NodeTrait for NodePattern {
                 Attribute::Y => p.y = Some(parse("y", value, LengthDir::Vertical, None)?),
 
                 Attribute::Width => {
-                    p.width = Some(parse("width",
-                                         value,
-                                         LengthDir::Horizontal,
-                                         Some(RsvgLength::check_nonnegative))?)
+                    p.width = Some(parse(
+                        "width",
+                        value,
+                        LengthDir::Horizontal,
+                        Some(RsvgLength::check_nonnegative),
+                    )?)
                 }
 
                 Attribute::Height => {
-                    p.height = Some(parse("height",
-                                          value,
-                                          LengthDir::Vertical,
-                                          Some(RsvgLength::check_nonnegative))?)
+                    p.height = Some(parse(
+                        "height",
+                        value,
+                        LengthDir::Vertical,
+                        Some(RsvgLength::check_nonnegative),
+                    )?)
                 }
 
                 _ => (),
@@ -231,9 +241,8 @@ fn resolve_pattern(pattern: &Pattern, fallback_source: &mut FallbackSource) -> P
         }
 
         if let Some(fallback_node) = opt_fallback {
-            fallback_node.with_impl(|i: &NodePattern| {
-                                        result.resolve_from_fallback(&*i.pattern.borrow())
-                                    });
+            fallback_node
+                .with_impl(|i: &NodePattern| result.resolve_from_fallback(&*i.pattern.borrow()));
         } else {
             result.resolve_from_defaults();
             break;
@@ -250,8 +259,10 @@ struct NodeFallbackSource {
 
 impl NodeFallbackSource {
     fn new(draw_ctx: *mut RsvgDrawingCtx) -> NodeFallbackSource {
-        NodeFallbackSource { draw_ctx,
-                             acquired_nodes: Vec::<*mut RsvgNode>::new(), }
+        NodeFallbackSource {
+            draw_ctx,
+            acquired_nodes: Vec::<*mut RsvgNode>::new(),
+        }
     }
 }
 
@@ -280,10 +291,11 @@ impl FallbackSource for NodeFallbackSource {
     }
 }
 
-fn set_pattern_on_draw_context(pattern: &Pattern,
-                               draw_ctx: *mut RsvgDrawingCtx,
-                               bbox: &RsvgBbox)
-                               -> bool {
+fn set_pattern_on_draw_context(
+    pattern: &Pattern,
+    draw_ctx: *mut RsvgDrawingCtx,
+    bbox: &RsvgBbox,
+) -> bool {
     assert!(pattern.is_resolved());
 
     if !node_has_children(&pattern.node) {
@@ -326,8 +338,10 @@ fn set_pattern_on_draw_context(pattern: &Pattern,
         }
     }
 
-    let taffine = cairo::Matrix::multiply(&pattern_affine,
-                                          &drawing_ctx::get_current_state_affine(draw_ctx));
+    let taffine = cairo::Matrix::multiply(
+        &pattern_affine,
+        &drawing_ctx::get_current_state_affine(draw_ctx),
+    );
 
     let mut scwscale = (taffine.xx * taffine.xx + taffine.xy * taffine.xy).sqrt();
     let mut schscale = (taffine.yx * taffine.yx + taffine.yy * taffine.yy).sqrt();
@@ -350,8 +364,10 @@ fn set_pattern_on_draw_context(pattern: &Pattern,
     // Create the pattern coordinate system
     match units {
         PatternUnits(CoordUnits::ObjectBoundingBox) => {
-            affine.translate(bbox.rect.x + pattern_x * bbox.rect.width,
-                             bbox.rect.y + pattern_y * bbox.rect.height);
+            affine.translate(
+                bbox.rect.x + pattern_x * bbox.rect.width,
+                bbox.rect.y + pattern_y * bbox.rect.height,
+            );
         }
 
         PatternUnits(CoordUnits::UserSpaceOnUse) => {
@@ -369,12 +385,14 @@ fn set_pattern_on_draw_context(pattern: &Pattern,
     // Create the pattern contents coordinate system
     if let Some(vbox) = vbox {
         // If there is a vbox, use that
-        let (mut x, mut y, w, h) = preserve_aspect_ratio.compute(vbox.0.width,
-                                                                 vbox.0.height,
-                                                                 0.0,
-                                                                 0.0,
-                                                                 pattern_width * bbwscale,
-                                                                 pattern_height * bbhscale);
+        let (mut x, mut y, w, h) = preserve_aspect_ratio.compute(
+            vbox.0.width,
+            vbox.0.height,
+            0.0,
+            0.0,
+            pattern_width * bbwscale,
+            pattern_height * bbhscale,
+        );
 
         x -= vbox.0.x * w / vbox.0.width;
         y -= vbox.0.y * h / vbox.0.height;
@@ -412,8 +430,9 @@ fn set_pattern_on_draw_context(pattern: &Pattern,
     let cr_save = drawing_ctx::get_cairo_context(draw_ctx);
     drawing_ctx::state_push(draw_ctx);
 
-    let surface = cr_save.get_target()
-                         .create_similar(cairo::Content::ColorAlpha, pw, ph);
+    let surface = cr_save
+        .get_target()
+        .create_similar(cairo::Content::ColorAlpha, pw, ph);
 
     let cr_pattern = cairo::Context::new(&surface);
 
@@ -451,10 +470,11 @@ fn set_pattern_on_draw_context(pattern: &Pattern,
     true
 }
 
-fn resolve_fallbacks_and_set_pattern(pattern: &Pattern,
-                                     draw_ctx: *mut RsvgDrawingCtx,
-                                     bbox: &RsvgBbox)
-                                     -> bool {
+fn resolve_fallbacks_and_set_pattern(
+    pattern: &Pattern,
+    draw_ctx: *mut RsvgDrawingCtx,
+    bbox: &RsvgBbox,
+) -> bool {
     let mut fallback_source = NodeFallbackSource::new(draw_ctx);
 
     let resolved = resolve_pattern(pattern, &mut fallback_source);
@@ -463,24 +483,26 @@ fn resolve_fallbacks_and_set_pattern(pattern: &Pattern,
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_pattern_new(_: *const libc::c_char,
-                                        raw_parent: *const RsvgNode)
-                                        -> *const RsvgNode {
+pub extern "C" fn rsvg_node_pattern_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
     boxed_node_new(NodeType::Pattern, raw_parent, Box::new(NodePattern::new()))
 }
 
-pub fn pattern_resolve_fallbacks_and_set_pattern(node: &RsvgNode,
-                                                 draw_ctx: *mut RsvgDrawingCtx,
-                                                 bbox: &RsvgBbox)
-                                                 -> bool {
+pub fn pattern_resolve_fallbacks_and_set_pattern(
+    node: &RsvgNode,
+    draw_ctx: *mut RsvgDrawingCtx,
+    bbox: &RsvgBbox,
+) -> bool {
     assert!(node.get_type() == NodeType::Pattern);
 
     let mut did_set_pattern = false;
 
     node.with_impl(|node_pattern: &NodePattern| {
-                       let pattern = &*node_pattern.pattern.borrow();
-                       did_set_pattern = resolve_fallbacks_and_set_pattern(pattern, draw_ctx, bbox);
-                   });
+        let pattern = &*node_pattern.pattern.borrow();
+        did_set_pattern = resolve_fallbacks_and_set_pattern(pattern, draw_ctx, bbox);
+    });
 
     did_set_pattern
 }
diff --git a/rsvg_internals/src/property_bag.rs b/rsvg_internals/src/property_bag.rs
index 603bb6d3..4b8d8514 100644
--- a/rsvg_internals/src/property_bag.rs
+++ b/rsvg_internals/src/property_bag.rs
@@ -124,7 +124,8 @@ impl<'a> Iterator for PropertyBagIter<'a> {
     type Item = (&'a str, Attribute, &'a str);
 
     fn next(&mut self) -> Option<Self::Item> {
-        self.0.next()
+        self.0
+            .next()
             .map(|(k, a, v)| (k.to_str_utf8(), a, v.to_str_utf8()))
     }
 }
@@ -138,8 +139,9 @@ impl<'a> Iterator for PropertyBagCStrIter<'a> {
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_property_bag_new<'a>(atts: *const *const libc::c_char)
-                                            -> *const PropertyBag<'a> {
+pub extern "C" fn rsvg_property_bag_new<'a>(
+    atts: *const *const libc::c_char,
+) -> *const PropertyBag<'a> {
     let pbag = unsafe { PropertyBag::new_from_key_value_pairs(atts) };
     Box::into_raw(Box::new(pbag))
 }
@@ -152,8 +154,9 @@ pub extern "C" fn rsvg_property_bag_free(pbag: *mut PropertyBag) {
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_property_bag_iter_begin(pbag: *const PropertyBag)
-                                               -> *mut PropertyBagCStrIter {
+pub extern "C" fn rsvg_property_bag_iter_begin(
+    pbag: *const PropertyBag,
+) -> *mut PropertyBagCStrIter {
     assert!(!pbag.is_null());
     let pbag = unsafe { &*pbag };
 
@@ -161,11 +164,12 @@ pub extern "C" fn rsvg_property_bag_iter_begin(pbag: *const PropertyBag)
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_property_bag_iter_next(iter: *mut PropertyBagCStrIter,
-                                              out_key: *mut *const libc::c_char,
-                                              out_attr: *mut Attribute,
-                                              out_value: *mut *const libc::c_char)
-                                              -> glib_sys::gboolean {
+pub extern "C" fn rsvg_property_bag_iter_next(
+    iter: *mut PropertyBagCStrIter,
+    out_key: *mut *const libc::c_char,
+    out_attr: *mut Attribute,
+    out_value: *mut *const libc::c_char,
+) -> glib_sys::gboolean {
     assert!(!iter.is_null());
     let iter = unsafe { &mut *iter };
 
@@ -206,10 +210,12 @@ mod tests {
 
     #[test]
     fn property_bag_iters() {
-        let pairs = [CString::new("rx").unwrap(),
-                     CString::new("1").unwrap(),
-                     CString::new("ry").unwrap(),
-                     CString::new("2").unwrap()];
+        let pairs = [
+            CString::new("rx").unwrap(),
+            CString::new("1").unwrap(),
+            CString::new("ry").unwrap(),
+            CString::new("2").unwrap(),
+        ];
 
         let mut v = Vec::new();
 
@@ -244,10 +250,12 @@ mod tests {
 
     #[test]
     fn property_bag_can_iterate_from_c() {
-        let pairs = [CString::new("rx").unwrap(),
-                     CString::new("1").unwrap(),
-                     CString::new("ry").unwrap(),
-                     CString::new("2").unwrap()];
+        let pairs = [
+            CString::new("rx").unwrap(),
+            CString::new("1").unwrap(),
+            CString::new("ry").unwrap(),
+            CString::new("2").unwrap(),
+        ];
 
         let mut v = Vec::new();
 
@@ -268,11 +276,12 @@ mod tests {
         let mut att = unsafe { mem::uninitialized() };
         let mut val = unsafe { mem::uninitialized() };
 
-        while from_glib(rsvg_property_bag_iter_next(iter,
-                                                    &mut key as *mut _,
-                                                    &mut att as *mut _,
-                                                    &mut val as *mut _))
-        {
+        while from_glib(rsvg_property_bag_iter_next(
+            iter,
+            &mut key as *mut _,
+            &mut att as *mut _,
+            &mut val as *mut _,
+        )) {
             let k = unsafe { CStr::from_ptr(key).to_str_utf8() };
             let v = unsafe { CStr::from_ptr(val).to_str_utf8() };
 
diff --git a/rsvg_internals/src/shapes.rs b/rsvg_internals/src/shapes.rs
index 8543e2e4..07d492ff 100644
--- a/rsvg_internals/src/shapes.rs
+++ b/rsvg_internals/src/shapes.rs
@@ -17,11 +17,13 @@ use path_parser;
 use property_bag::PropertyBag;
 use state::RsvgState;
 
-fn render_path_builder(builder: &RsvgPathBuilder,
-                       draw_ctx: *const RsvgDrawingCtx,
-                       state: *mut RsvgState,
-                       dominate: i32,
-                       render_markers: bool) {
+fn render_path_builder(
+    builder: &RsvgPathBuilder,
+    draw_ctx: *const RsvgDrawingCtx,
+    state: *mut RsvgState,
+    dominate: i32,
+    render_markers: bool,
+) {
     drawing_ctx::state_reinherit_top(draw_ctx, state, dominate);
     drawing_ctx::render_path_builder(draw_ctx, builder);
 
@@ -30,13 +32,15 @@ fn render_path_builder(builder: &RsvgPathBuilder,
     }
 }
 
-fn render_ellipse(cx: f64,
-                  cy: f64,
-                  rx: f64,
-                  ry: f64,
-                  node: &RsvgNode,
-                  draw_ctx: *const RsvgDrawingCtx,
-                  dominate: i32) {
+fn render_ellipse(
+    cx: f64,
+    cy: f64,
+    rx: f64,
+    ry: f64,
+    node: &RsvgNode,
+    draw_ctx: *const RsvgDrawingCtx,
+    dominate: i32,
+) {
     // Per the spec, rx and ry must be nonnegative
     if rx <= 0.0 || ry <= 0.0 {
         return;
@@ -50,33 +54,41 @@ fn render_ellipse(cx: f64,
 
     builder.move_to(cx + rx, cy);
 
-    builder.curve_to(cx + rx,
-                     cy - arc_magic * ry,
-                     cx + arc_magic * rx,
-                     cy - ry,
-                     cx,
-                     cy - ry);
-
-    builder.curve_to(cx - arc_magic * rx,
-                     cy - ry,
-                     cx - rx,
-                     cy - arc_magic * ry,
-                     cx - rx,
-                     cy);
-
-    builder.curve_to(cx - rx,
-                     cy + arc_magic * ry,
-                     cx - arc_magic * rx,
-                     cy + ry,
-                     cx,
-                     cy + ry);
-
-    builder.curve_to(cx + arc_magic * rx,
-                     cy + ry,
-                     cx + rx,
-                     cy + arc_magic * ry,
-                     cx + rx,
-                     cy);
+    builder.curve_to(
+        cx + rx,
+        cy - arc_magic * ry,
+        cx + arc_magic * rx,
+        cy - ry,
+        cx,
+        cy - ry,
+    );
+
+    builder.curve_to(
+        cx - arc_magic * rx,
+        cy - ry,
+        cx - rx,
+        cy - arc_magic * ry,
+        cx - rx,
+        cy,
+    );
+
+    builder.curve_to(
+        cx - rx,
+        cy + arc_magic * ry,
+        cx - arc_magic * rx,
+        cy + ry,
+        cx,
+        cy + ry,
+    );
+
+    builder.curve_to(
+        cx + arc_magic * rx,
+        cy + ry,
+        cx + rx,
+        cy + arc_magic * ry,
+        cx + rx,
+        cy,
+    );
 
     builder.close_path();
 
@@ -90,7 +102,9 @@ struct NodePath {
 
 impl NodePath {
     fn new() -> NodePath {
-        NodePath { builder: RefCell::new(None), }
+        NodePath {
+            builder: RefCell::new(None),
+        }
     }
 }
 
@@ -137,8 +151,10 @@ struct NodePoly {
 
 impl NodePoly {
     fn new(kind: PolyKind) -> NodePoly {
-        NodePoly { points: RefCell::new(None),
-                   kind, }
+        NodePoly {
+            points: RefCell::new(None),
+            kind,
+        }
     }
 }
 
@@ -200,10 +216,12 @@ struct NodeLine {
 
 impl NodeLine {
     fn new() -> NodeLine {
-        NodeLine { x1: Cell::new(RsvgLength::default()),
-                   y1: Cell::new(RsvgLength::default()),
-                   x2: Cell::new(RsvgLength::default()),
-                   y2: Cell::new(RsvgLength::default()), }
+        NodeLine {
+            x1: Cell::new(RsvgLength::default()),
+            y1: Cell::new(RsvgLength::default()),
+            x2: Cell::new(RsvgLength::default()),
+            y2: Cell::new(RsvgLength::default()),
+        }
     }
 }
 
@@ -211,9 +229,11 @@ impl NodeTrait for NodeLine {
     fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, pbag: &PropertyBag) -> NodeResult {
         for (_key, attr, value) in pbag.iter() {
             match attr {
-                Attribute::X1 => self.x1.set(parse("x1", value, LengthDir::Horizontal, None)?),
+                Attribute::X1 => self.x1
+                    .set(parse("x1", value, LengthDir::Horizontal, None)?),
                 Attribute::Y1 => self.y1.set(parse("y1", value, LengthDir::Vertical, None)?),
-                Attribute::X2 => self.x2.set(parse("x2", value, LengthDir::Horizontal, None)?),
+                Attribute::X2 => self.x2
+                    .set(parse("x2", value, LengthDir::Horizontal, None)?),
                 Attribute::Y2 => self.y2.set(parse("y2", value, LengthDir::Vertical, None)?),
                 _ => (),
             }
@@ -256,13 +276,15 @@ struct NodeRect {
 
 impl NodeRect {
     fn new() -> NodeRect {
-        NodeRect { x: Cell::new(RsvgLength::default()),
-                   y: Cell::new(RsvgLength::default()),
-                   w: Cell::new(RsvgLength::default()),
-                   h: Cell::new(RsvgLength::default()),
-
-                   rx: Cell::new(None),
-                   ry: Cell::new(None), }
+        NodeRect {
+            x: Cell::new(RsvgLength::default()),
+            y: Cell::new(RsvgLength::default()),
+            w: Cell::new(RsvgLength::default()),
+            h: Cell::new(RsvgLength::default()),
+
+            rx: Cell::new(None),
+            ry: Cell::new(None),
+        }
     }
 }
 
@@ -270,19 +292,33 @@ impl NodeTrait for NodeRect {
     fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, pbag: &PropertyBag) -> NodeResult {
         for (_key, attr, value) in pbag.iter() {
             match attr {
-                Attribute::X      => self.x.set (parse ("x", value, LengthDir::Horizontal, None)?),
-                Attribute::Y      => self.y.set (parse ("y", value, LengthDir::Vertical, None)?),
-                Attribute::Width  => self.w.set (parse ("width", value, LengthDir::Horizontal,
-                                                        Some(RsvgLength::check_nonnegative))?),
-                Attribute::Height => self.h.set (parse ("height", value, LengthDir::Vertical,
-                                                        Some(RsvgLength::check_nonnegative))?),
-
-                Attribute::Rx => self.rx.set (parse ("rx", value, LengthDir::Horizontal,
-                                                     Some(RsvgLength::check_nonnegative))
-                                              .map(Some)?),
-                Attribute::Ry => self.ry.set (parse ("ry", value, LengthDir::Vertical,
-                                                     Some(RsvgLength::check_nonnegative))
-                                              .map(Some)?),
+                Attribute::X => self.x.set(parse("x", value, LengthDir::Horizontal, None)?),
+                Attribute::Y => self.y.set(parse("y", value, LengthDir::Vertical, None)?),
+                Attribute::Width => self.w.set(parse(
+                    "width",
+                    value,
+                    LengthDir::Horizontal,
+                    Some(RsvgLength::check_nonnegative),
+                )?),
+                Attribute::Height => self.h.set(parse(
+                    "height",
+                    value,
+                    LengthDir::Vertical,
+                    Some(RsvgLength::check_nonnegative),
+                )?),
+
+                Attribute::Rx => self.rx.set(parse(
+                    "rx",
+                    value,
+                    LengthDir::Horizontal,
+                    Some(RsvgLength::check_nonnegative),
+                ).map(Some)?),
+                Attribute::Ry => self.ry.set(parse(
+                    "ry",
+                    value,
+                    LengthDir::Vertical,
+                    Some(RsvgLength::check_nonnegative),
+                ).map(Some)?),
 
                 _ => (),
             }
@@ -443,9 +479,11 @@ struct NodeCircle {
 
 impl NodeCircle {
     fn new() -> NodeCircle {
-        NodeCircle { cx: Cell::new(RsvgLength::default()),
-                     cy: Cell::new(RsvgLength::default()),
-                     r: Cell::new(RsvgLength::default()), }
+        NodeCircle {
+            cx: Cell::new(RsvgLength::default()),
+            cy: Cell::new(RsvgLength::default()),
+            r: Cell::new(RsvgLength::default()),
+        }
     }
 }
 
@@ -453,12 +491,15 @@ impl NodeTrait for NodeCircle {
     fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, pbag: &PropertyBag) -> NodeResult {
         for (_key, attr, value) in pbag.iter() {
             match attr {
-                Attribute::Cx => self.cx.set(parse("cx", value, LengthDir::Horizontal, None)?),
+                Attribute::Cx => self.cx
+                    .set(parse("cx", value, LengthDir::Horizontal, None)?),
                 Attribute::Cy => self.cy.set(parse("cy", value, LengthDir::Vertical, None)?),
-                Attribute::R => self.r.set(parse("r",
-                                                 value,
-                                                 LengthDir::Both,
-                                                 Some(RsvgLength::check_nonnegative))?),
+                Attribute::R => self.r.set(parse(
+                    "r",
+                    value,
+                    LengthDir::Both,
+                    Some(RsvgLength::check_nonnegative),
+                )?),
 
                 _ => (),
             }
@@ -490,10 +531,12 @@ struct NodeEllipse {
 
 impl NodeEllipse {
     fn new() -> NodeEllipse {
-        NodeEllipse { cx: Cell::new(RsvgLength::default()),
-                      cy: Cell::new(RsvgLength::default()),
-                      rx: Cell::new(RsvgLength::default()),
-                      ry: Cell::new(RsvgLength::default()), }
+        NodeEllipse {
+            cx: Cell::new(RsvgLength::default()),
+            cy: Cell::new(RsvgLength::default()),
+            rx: Cell::new(RsvgLength::default()),
+            ry: Cell::new(RsvgLength::default()),
+        }
     }
 }
 
@@ -501,17 +544,22 @@ impl NodeTrait for NodeEllipse {
     fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, pbag: &PropertyBag) -> NodeResult {
         for (_key, attr, value) in pbag.iter() {
             match attr {
-                Attribute::Cx => self.cx.set(parse("cx", value, LengthDir::Horizontal, None)?),
+                Attribute::Cx => self.cx
+                    .set(parse("cx", value, LengthDir::Horizontal, None)?),
                 Attribute::Cy => self.cy.set(parse("cy", value, LengthDir::Vertical, None)?),
 
-                Attribute::Rx => self.rx.set(parse("rx",
-                                                   value,
-                                                   LengthDir::Horizontal,
-                                                   Some(RsvgLength::check_nonnegative))?),
-                Attribute::Ry => self.ry.set(parse("ry",
-                                                   value,
-                                                   LengthDir::Vertical,
-                                                   Some(RsvgLength::check_nonnegative))?),
+                Attribute::Rx => self.rx.set(parse(
+                    "rx",
+                    value,
+                    LengthDir::Horizontal,
+                    Some(RsvgLength::check_nonnegative),
+                )?),
+                Attribute::Ry => self.ry.set(parse(
+                    "ry",
+                    value,
+                    LengthDir::Vertical,
+                    Some(RsvgLength::check_nonnegative),
+                )?),
 
                 _ => (),
             }
@@ -536,54 +584,65 @@ impl NodeTrait for NodeEllipse {
 
 // ************ C Prototypes ************
 #[no_mangle]
-pub extern "C" fn rsvg_node_path_new(_: *const libc::c_char,
-                                     raw_parent: *const RsvgNode)
-                                     -> *const RsvgNode {
+pub extern "C" fn rsvg_node_path_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
     boxed_node_new(NodeType::Path, raw_parent, Box::new(NodePath::new()))
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_polygon_new(_: *const libc::c_char,
-                                        raw_parent: *const RsvgNode)
-                                        -> *const RsvgNode {
-    boxed_node_new(NodeType::Path,
-                   raw_parent,
-                   Box::new(NodePoly::new(PolyKind::Closed)))
+pub extern "C" fn rsvg_node_polygon_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
+    boxed_node_new(
+        NodeType::Path,
+        raw_parent,
+        Box::new(NodePoly::new(PolyKind::Closed)),
+    )
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_polyline_new(_: *const libc::c_char,
-                                         raw_parent: *const RsvgNode)
-                                         -> *const RsvgNode {
-    boxed_node_new(NodeType::Path,
-                   raw_parent,
-                   Box::new(NodePoly::new(PolyKind::Open)))
+pub extern "C" fn rsvg_node_polyline_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
+    boxed_node_new(
+        NodeType::Path,
+        raw_parent,
+        Box::new(NodePoly::new(PolyKind::Open)),
+    )
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_line_new(_: *const libc::c_char,
-                                     raw_parent: *const RsvgNode)
-                                     -> *const RsvgNode {
+pub extern "C" fn rsvg_node_line_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
     boxed_node_new(NodeType::Line, raw_parent, Box::new(NodeLine::new()))
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_rect_new(_: *const libc::c_char,
-                                     raw_parent: *const RsvgNode)
-                                     -> *const RsvgNode {
+pub extern "C" fn rsvg_node_rect_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
     boxed_node_new(NodeType::Rect, raw_parent, Box::new(NodeRect::new()))
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_circle_new(_: *const libc::c_char,
-                                       raw_parent: *const RsvgNode)
-                                       -> *const RsvgNode {
+pub extern "C" fn rsvg_node_circle_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
     boxed_node_new(NodeType::Circle, raw_parent, Box::new(NodeCircle::new()))
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_ellipse_new(_: *const libc::c_char,
-                                        raw_parent: *const RsvgNode)
-                                        -> *const RsvgNode {
+pub extern "C" fn rsvg_node_ellipse_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
     boxed_node_new(NodeType::Ellipse, raw_parent, Box::new(NodeEllipse::new()))
 }
diff --git a/rsvg_internals/src/space.rs b/rsvg_internals/src/space.rs
index 937befeb..4d59bab8 100644
--- a/rsvg_internals/src/space.rs
+++ b/rsvg_internals/src/space.rs
@@ -31,17 +31,18 @@ pub fn xml_space_normalize(mode: XmlSpace, s: &str) -> String {
 // leading and trailing space characters. Then, all contiguous space
 // characters will be consolidated.
 fn normalize_default(s: &str) -> String {
-    s.trim().chars()
-     .filter(|ch| *ch != '\n')
-     .map(|ch| match ch {
-              '\t' => ' ',
-              c => c,
-          })
-     .coalesce(|current, next| match (current, next) {
-                   (' ', ' ') => Ok(' '),
-                   (_, _) => Err((current, next)),
-               })
-     .collect::<String>()
+    s.trim()
+        .chars()
+        .filter(|ch| *ch != '\n')
+        .map(|ch| match ch {
+            '\t' => ' ',
+            c => c,
+        })
+        .coalesce(|current, next| match (current, next) {
+            (' ', ' ') => Ok(' '),
+            (_, _) => Err((current, next)),
+        })
+        .collect::<String>()
 }
 
 // From https://www.w3.org/TR/SVG/text.html#WhiteSpace
@@ -55,18 +56,20 @@ fn normalize_default(s: &str) -> String {
 // and "b") will produce a larger separation between "a" and "b" than
 // "a b" (one space between "a" and "b").
 fn normalize_preserve(s: &str) -> String {
-    s.chars().map(|ch| match ch {
-              '\n' | '\t' => ' ',
+    s.chars()
+        .map(|ch| match ch {
+            '\n' | '\t' => ' ',
 
-              c => c,
-          })
-     .collect()
+            c => c,
+        })
+        .collect()
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_xml_space_normalize(mode: XmlSpace,
-                                           s: *const libc::c_char)
-                                           -> *const libc::c_char {
+pub extern "C" fn rsvg_xml_space_normalize(
+    mode: XmlSpace,
+    s: *const libc::c_char,
+) -> *const libc::c_char {
     let rs = unsafe { utf8_cstr(s) };
 
     xml_space_normalize(mode, rs).to_glib_full()
@@ -78,31 +81,59 @@ mod tests {
 
     #[test]
     fn xml_space_default() {
-        assert_eq!(xml_space_normalize(XmlSpace::Default,
-                                       "\n    WS example\n    indented lines\n  "),
-                   "WS example indented lines");
-        assert_eq!(xml_space_normalize(XmlSpace::Default,
-                                       "\n  \t  \tWS \t\t\texample\n  \t  indented lines\t\t  \
-                                        \n  "),
-                   "WS example indented lines");
-        assert_eq!(xml_space_normalize(XmlSpace::Default, "\n  \t  \tWS \t\t\texample\n  \t  duplicate 
letters\t\t  \n  "),
-                   "WS example duplicate letters");
-        assert_eq!(xml_space_normalize(XmlSpace::Default, "\nWS example\nnon-indented lines\n  "),
-                   "WS examplenon-indented lines");
-        assert_eq!(xml_space_normalize(XmlSpace::Default, "\nWS example\tnon-indented lines\n  "),
-                   "WS example non-indented lines");
+        assert_eq!(
+            xml_space_normalize(
+                XmlSpace::Default,
+                "\n    WS example\n    indented lines\n  "
+            ),
+            "WS example indented lines"
+        );
+        assert_eq!(
+            xml_space_normalize(
+                XmlSpace::Default,
+                "\n  \t  \tWS \t\t\texample\n  \t  indented lines\t\t  \n  "
+            ),
+            "WS example indented lines"
+        );
+        assert_eq!(
+            xml_space_normalize(
+                XmlSpace::Default,
+                "\n  \t  \tWS \t\t\texample\n  \t  duplicate letters\t\t  \n  "
+            ),
+            "WS example duplicate letters"
+        );
+        assert_eq!(
+            xml_space_normalize(XmlSpace::Default, "\nWS example\nnon-indented lines\n  "),
+            "WS examplenon-indented lines"
+        );
+        assert_eq!(
+            xml_space_normalize(XmlSpace::Default, "\nWS example\tnon-indented lines\n  "),
+            "WS example non-indented lines"
+        );
     }
 
     #[test]
     fn xml_space_preserve() {
-        assert_eq!(xml_space_normalize(XmlSpace::Preserve,
-                                       "\n    WS example\n    indented lines\n  "),
-                   "     WS example     indented lines   ");
-        assert_eq!(xml_space_normalize(XmlSpace::Preserve,
-                                       "\n  \t  \tWS \t\t\texample\n  \t  indented lines\t\t  \
-                                        \n  "),
-                   "       WS    example      indented lines       ");
-        assert_eq!(xml_space_normalize(XmlSpace::Preserve, "\n  \t  \tWS \t\t\texample\n  \t  duplicate 
letters\t\t  \n  "),
-                   "       WS    example      duplicate letters       ");
+        assert_eq!(
+            xml_space_normalize(
+                XmlSpace::Preserve,
+                "\n    WS example\n    indented lines\n  "
+            ),
+            "     WS example     indented lines   "
+        );
+        assert_eq!(
+            xml_space_normalize(
+                XmlSpace::Preserve,
+                "\n  \t  \tWS \t\t\texample\n  \t  indented lines\t\t  \n  "
+            ),
+            "       WS    example      indented lines       "
+        );
+        assert_eq!(
+            xml_space_normalize(
+                XmlSpace::Preserve,
+                "\n  \t  \tWS \t\t\texample\n  \t  duplicate letters\t\t  \n  "
+            ),
+            "       WS    example      duplicate letters       "
+        );
     }
 }
diff --git a/rsvg_internals/src/state.rs b/rsvg_internals/src/state.rs
index 0d210448..6dc095ac 100644
--- a/rsvg_internals/src/state.rs
+++ b/rsvg_internals/src/state.rs
@@ -33,9 +33,11 @@ pub struct FontDecor {
 
 impl From<TextDecoration> for FontDecor {
     fn from(td: TextDecoration) -> FontDecor {
-        FontDecor { overline: from_glib(td.overline),
-                    underline: from_glib(td.underline),
-                    strike: from_glib(td.strike), }
+        FontDecor {
+            overline: from_glib(td.overline),
+            underline: from_glib(td.underline),
+            strike: from_glib(td.strike),
+        }
     }
 }
 
diff --git a/rsvg_internals/src/stop.rs b/rsvg_internals/src/stop.rs
index 661d739b..103efa0b 100644
--- a/rsvg_internals/src/stop.rs
+++ b/rsvg_internals/src/stop.rs
@@ -24,8 +24,10 @@ pub struct NodeStop {
 
 impl NodeStop {
     fn new() -> NodeStop {
-        NodeStop { offset: Cell::new(0.0),
-                   rgba: Cell::new(0), }
+        NodeStop {
+            offset: Cell::new(0.0),
+            rgba: Cell::new(0),
+        }
     }
 
     pub fn get_offset(&self) -> f64 {
@@ -39,8 +41,7 @@ impl NodeStop {
 
 fn validate_offset(length: RsvgLength) -> Result<RsvgLength, AttributeError> {
     match length.unit {
-        LengthUnit::Default |
-        LengthUnit::Percent => {
+        LengthUnit::Default | LengthUnit::Percent => {
             let mut offset = length.length;
 
             if offset < 0.0 {
@@ -49,12 +50,16 @@ fn validate_offset(length: RsvgLength) -> Result<RsvgLength, AttributeError> {
                 offset = 1.0;
             }
 
-            Ok(RsvgLength::new(offset, LengthUnit::Default, LengthDir::Both))
-        },
-
-        _ => {
-            Err (AttributeError::Value ("stop offset must be in default or percent units".to_string()))
+            Ok(RsvgLength::new(
+                offset,
+                LengthUnit::Default,
+                LengthDir::Both,
+            ))
         }
+
+        _ => Err(AttributeError::Value(
+            "stop offset must be in default or percent units".to_string(),
+        )),
     }
 }
 
@@ -66,8 +71,9 @@ impl NodeTrait for NodeStop {
             match attr {
                 Attribute::Offset => {
                     let length = parse("offset", value, LengthDir::Both, Some(validate_offset))?;
-                    assert!(length.unit == LengthUnit::Default
-                            || length.unit == LengthUnit::Percent);
+                    assert!(
+                        length.unit == LengthUnit::Default || length.unit == LengthUnit::Percent
+                    );
                     self.offset.set(length.length);
                 }
 
@@ -100,15 +106,15 @@ impl NodeTrait for NodeStop {
 
         let mut color_rgba: cssparser::RGBA;
 
-        let stop_color = drawing_ctx::state_get_stop_color (state)
-            .map_err (|e| NodeError::attribute_error ("stop-color", e))?;
+        let stop_color = drawing_ctx::state_get_stop_color(state)
+            .map_err(|e| NodeError::attribute_error("stop-color", e))?;
 
         match stop_color {
             None => color_rgba = cssparser::RGBA::transparent(),
 
             Some(Color::Inherit) => {
-                let inherited_stop_color = drawing_ctx::state_get_stop_color (inherited_state)
-                    .map_err (|e| NodeError::attribute_error ("stop-color", e))?;
+                let inherited_stop_color = drawing_ctx::state_get_stop_color(inherited_state)
+                    .map_err(|e| NodeError::attribute_error("stop-color", e))?;
 
                 match inherited_stop_color {
                     None => unreachable!(),
@@ -137,15 +143,15 @@ impl NodeTrait for NodeStop {
             Some(Color::RGBA(rgba)) => color_rgba = rgba,
         }
 
-        let stop_opacity = drawing_ctx::state_get_stop_opacity (state)
-            .map_err (|e| NodeError::attribute_error ("stop-opacity", e))?;
+        let stop_opacity = drawing_ctx::state_get_stop_opacity(state)
+            .map_err(|e| NodeError::attribute_error("stop-opacity", e))?;
 
         match stop_opacity {
             None => color_rgba.alpha = 0xff,
 
             Some(Opacity::Inherit) => {
-                let inherited_opacity = drawing_ctx::state_get_stop_opacity (inherited_state)
-                    .map_err (|e| NodeError::attribute_error ("stop-opacity", e))?;
+                let inherited_opacity = drawing_ctx::state_get_stop_opacity(inherited_state)
+                    .map_err(|e| NodeError::attribute_error("stop-opacity", e))?;
 
                 match inherited_opacity {
                     Some(Opacity::Specified(opacity)) => color_rgba.alpha = opacity_to_u8(opacity),
@@ -174,7 +180,7 @@ impl NodeTrait for NodeStop {
 
 fn u32_from_rgba(rgba: cssparser::RGBA) -> u32 {
     (u32::from(rgba.red) << 24) | (u32::from(rgba.green) << 16) | (u32::from(rgba.blue) << 8)
-    | u32::from(rgba.alpha)
+        | u32::from(rgba.alpha)
 }
 
 extern "C" {
@@ -183,8 +189,9 @@ extern "C" {
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_stop_new(_: *const libc::c_char,
-                                     raw_parent: *const RsvgNode)
-                                     -> *const RsvgNode {
+pub extern "C" fn rsvg_node_stop_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
     boxed_node_new(NodeType::Stop, raw_parent, Box::new(NodeStop::new()))
 }
diff --git a/rsvg_internals/src/structure.rs b/rsvg_internals/src/structure.rs
index 20897848..09f0b19d 100644
--- a/rsvg_internals/src/structure.rs
+++ b/rsvg_internals/src/structure.rs
@@ -85,18 +85,18 @@ impl NodeTrait for NodeSwitch {
         drawing_ctx::push_discrete_layer(draw_ctx);
 
         node.foreach_child(|child| {
-                               if drawing_ctx::state_get_cond_true(child.get_state()) {
-                                   let boxed_child = box_node(child.clone());
+            if drawing_ctx::state_get_cond_true(child.get_state()) {
+                let boxed_child = box_node(child.clone());
 
-                                   drawing_ctx::draw_node_from_stack(draw_ctx, boxed_child, 0);
+                drawing_ctx::draw_node_from_stack(draw_ctx, boxed_child, 0);
 
-                                   rsvg_node_unref(boxed_child);
+                rsvg_node_unref(boxed_child);
 
-                                   false // just draw this child
-                               } else {
-                                   true
-                               }
-                           });
+                false // just draw this child
+            } else {
+                true
+            }
+        });
 
         drawing_ctx::pop_discrete_layer(draw_ctx);
     }
@@ -119,13 +119,15 @@ struct NodeSvg {
 
 impl NodeSvg {
     fn new() -> NodeSvg {
-        NodeSvg { preserve_aspect_ratio: Cell::new(AspectRatio::default()),
-                  x: Cell::new(RsvgLength::parse("0", LengthDir::Horizontal).unwrap()),
-                  y: Cell::new(RsvgLength::parse("0", LengthDir::Vertical).unwrap()),
-                  w: Cell::new(RsvgLength::parse("100%", LengthDir::Horizontal).unwrap()),
-                  h: Cell::new(RsvgLength::parse("100%", LengthDir::Vertical).unwrap()),
-                  vbox: Cell::new(None),
-                  pbag: RefCell::new(None), }
+        NodeSvg {
+            preserve_aspect_ratio: Cell::new(AspectRatio::default()),
+            x: Cell::new(RsvgLength::parse("0", LengthDir::Horizontal).unwrap()),
+            y: Cell::new(RsvgLength::parse("0", LengthDir::Vertical).unwrap()),
+            w: Cell::new(RsvgLength::parse("100%", LengthDir::Horizontal).unwrap()),
+            h: Cell::new(RsvgLength::parse("100%", LengthDir::Vertical).unwrap()),
+            vbox: Cell::new(None),
+            pbag: RefCell::new(None),
+        }
     }
 }
 
@@ -138,7 +140,8 @@ impl NodeTrait for NodeSvg {
         for (_key, attr, value) in pbag.iter() {
             match attr {
                 Attribute::PreserveAspectRatio => {
-                    self.preserve_aspect_ratio.set(parse("preserveAspectRatio", value, (), None)?)
+                    self.preserve_aspect_ratio
+                        .set(parse("preserveAspectRatio", value, (), None)?)
                 }
 
                 Attribute::X => {
@@ -153,15 +156,19 @@ impl NodeTrait for NodeSvg {
                     }
                 }
 
-                Attribute::Width => self.w.set(parse("width",
-                                                     value,
-                                                     LengthDir::Horizontal,
-                                                     Some(RsvgLength::check_nonnegative))?),
+                Attribute::Width => self.w.set(parse(
+                    "width",
+                    value,
+                    LengthDir::Horizontal,
+                    Some(RsvgLength::check_nonnegative),
+                )?),
 
-                Attribute::Height => self.h.set(parse("height",
-                                                      value,
-                                                      LengthDir::Vertical,
-                                                      Some(RsvgLength::check_nonnegative))?),
+                Attribute::Height => self.h.set(parse(
+                    "height",
+                    value,
+                    LengthDir::Vertical,
+                    Some(RsvgLength::check_nonnegative),
+                )?),
 
                 Attribute::ViewBox => self.vbox.set(parse("viewBox", value, (), None).map(Some)?),
 
@@ -187,21 +194,23 @@ impl NodeTrait for NodeSvg {
         let state = drawing_ctx::get_current_state(draw_ctx);
         let do_clip = !drawing_ctx::state_is_overflow(state) && node.get_parent().is_some();
 
-        draw_in_viewport(nx,
-                         ny,
-                         nw,
-                         nh,
-                         ClipMode::ClipToViewport,
-                         do_clip,
-                         self.vbox.get(),
-                         self.preserve_aspect_ratio.get(),
-                         drawing_ctx::get_current_state_affine(draw_ctx),
-                         draw_ctx,
-                         || {
-                             drawing_ctx::state_push(draw_ctx);
-                             node.draw_children(draw_ctx, -1); // dominate==-1 so it won't reinherit or push 
a layer
-                             drawing_ctx::state_pop(draw_ctx);
-                         });
+        draw_in_viewport(
+            nx,
+            ny,
+            nw,
+            nh,
+            ClipMode::ClipToViewport,
+            do_clip,
+            self.vbox.get(),
+            self.preserve_aspect_ratio.get(),
+            drawing_ctx::get_current_state_affine(draw_ctx),
+            draw_ctx,
+            || {
+                drawing_ctx::state_push(draw_ctx);
+                node.draw_children(draw_ctx, -1); // dominate==-1 so it won't reinherit or push a layer
+                drawing_ctx::state_pop(draw_ctx);
+            },
+        );
     }
 
     fn get_c_impl(&self) -> *const RsvgCNodeImpl {
@@ -220,11 +229,13 @@ struct NodeUse {
 
 impl NodeUse {
     fn new() -> NodeUse {
-        NodeUse { link: RefCell::new(None),
-                  x: Cell::new(RsvgLength::default()),
-                  y: Cell::new(RsvgLength::default()),
-                  w: Cell::new(None),
-                  h: Cell::new(None), }
+        NodeUse {
+            link: RefCell::new(None),
+            x: Cell::new(RsvgLength::default()),
+            y: Cell::new(RsvgLength::default()),
+            w: Cell::new(None),
+            h: Cell::new(None),
+        }
     }
 }
 
@@ -234,15 +245,21 @@ impl NodeTrait for NodeUse {
             match attr {
                 Attribute::XlinkHref => *self.link.borrow_mut() = Some(value.to_owned()),
 
-                Attribute::X         => self.x.set(parse("x", value, LengthDir::Horizontal, None)?),
-                Attribute::Y         => self.y.set(parse("y", value, LengthDir::Vertical, None)?),
-
-                Attribute::Width     => self.w.set(parse("width", value, LengthDir::Horizontal,
-                                                         Some(RsvgLength::check_nonnegative))
-                                                   .map(Some)?),
-                Attribute::Height    => self.h.set(parse("height", value, LengthDir::Vertical,
-                                                         Some(RsvgLength::check_nonnegative))
-                                                   .map(Some)?),
+                Attribute::X => self.x.set(parse("x", value, LengthDir::Horizontal, None)?),
+                Attribute::Y => self.y.set(parse("y", value, LengthDir::Vertical, None)?),
+
+                Attribute::Width => self.w.set(parse(
+                    "width",
+                    value,
+                    LengthDir::Horizontal,
+                    Some(RsvgLength::check_nonnegative),
+                ).map(Some)?),
+                Attribute::Height => self.h.set(parse(
+                    "height",
+                    value,
+                    LengthDir::Vertical,
+                    Some(RsvgLength::check_nonnegative),
+                ).map(Some)?),
 
                 _ => (),
             }
@@ -278,12 +295,14 @@ impl NodeTrait for NodeUse {
         // From https://www.w3.org/TR/SVG/struct.html#UseElement in
         // "If the ‘use’ element references a ‘symbol’ element"
 
-        let nw = self.w.get()
-                     .unwrap_or_else(|| RsvgLength::parse("100%", LengthDir::Horizontal).unwrap())
-                     .normalize(draw_ctx);
-        let nh = self.h.get()
-                     .unwrap_or_else(|| RsvgLength::parse("100%", LengthDir::Vertical).unwrap())
-                     .normalize(draw_ctx);
+        let nw = self.w
+            .get()
+            .unwrap_or_else(|| RsvgLength::parse("100%", LengthDir::Horizontal).unwrap())
+            .normalize(draw_ctx);
+        let nh = self.h
+            .get()
+            .unwrap_or_else(|| RsvgLength::parse("100%", LengthDir::Vertical).unwrap())
+            .normalize(draw_ctx);
 
         // width or height set to 0 disables rendering of the element
         // https://www.w3.org/TR/SVG/struct.html#UseElementWidthAttribute
@@ -311,27 +330,28 @@ impl NodeTrait for NodeUse {
             drawing_ctx::pop_discrete_layer(draw_ctx);
         } else {
             child.with_impl(|symbol: &NodeSymbol| {
-                                let do_clip =
-                                    !drawing_ctx::state_is_overflow(state)
-                                    || (!drawing_ctx::state_has_overflow(state)
-                                        && drawing_ctx::state_is_overflow(child.get_state()));
-
-                                draw_in_viewport(nx,
-                                                 ny,
-                                                 nw,
-                                                 nh,
-                                                 ClipMode::ClipToVbox,
-                                                 do_clip,
-                                                 symbol.vbox.get(),
-                                                 symbol.preserve_aspect_ratio.get(),
-                                                 drawing_ctx::get_current_state_affine(draw_ctx),
-                                                 draw_ctx,
-                                                 || {
-                                                     drawing_ctx::state_push(draw_ctx);
-                                                     child.draw_children(draw_ctx, 1);
-                                                     drawing_ctx::state_pop(draw_ctx);
-                                                 });
-                            });
+                let do_clip = !drawing_ctx::state_is_overflow(state)
+                    || (!drawing_ctx::state_has_overflow(state)
+                        && drawing_ctx::state_is_overflow(child.get_state()));
+
+                draw_in_viewport(
+                    nx,
+                    ny,
+                    nw,
+                    nh,
+                    ClipMode::ClipToVbox,
+                    do_clip,
+                    symbol.vbox.get(),
+                    symbol.preserve_aspect_ratio.get(),
+                    drawing_ctx::get_current_state_affine(draw_ctx),
+                    draw_ctx,
+                    || {
+                        drawing_ctx::state_push(draw_ctx);
+                        child.draw_children(draw_ctx, 1);
+                        drawing_ctx::state_pop(draw_ctx);
+                    },
+                );
+            });
 
             drawing_ctx::release_node(draw_ctx, raw_child);
         }
@@ -350,8 +370,10 @@ struct NodeSymbol {
 
 impl NodeSymbol {
     fn new() -> NodeSymbol {
-        NodeSymbol { preserve_aspect_ratio: Cell::new(AspectRatio::default()),
-                     vbox: Cell::new(None), }
+        NodeSymbol {
+            preserve_aspect_ratio: Cell::new(AspectRatio::default()),
+            vbox: Cell::new(None),
+        }
     }
 }
 
@@ -360,7 +382,8 @@ impl NodeTrait for NodeSymbol {
         for (_key, attr, value) in pbag.iter() {
             match attr {
                 Attribute::PreserveAspectRatio => {
-                    self.preserve_aspect_ratio.set(parse("preserveAspectRatio", value, (), None)?)
+                    self.preserve_aspect_ratio
+                        .set(parse("preserveAspectRatio", value, (), None)?)
                 }
 
                 Attribute::ViewBox => self.vbox.set(parse("viewBox", value, (), None).map(Some)?),
@@ -383,51 +406,59 @@ impl NodeTrait for NodeSymbol {
 
 // ************ C Prototypes ************
 #[no_mangle]
-pub extern "C" fn rsvg_node_group_new(_: *const libc::c_char,
-                                      raw_parent: *const RsvgNode)
-                                      -> *const RsvgNode {
+pub extern "C" fn rsvg_node_group_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
     boxed_node_new(NodeType::Group, raw_parent, Box::new(NodeGroup::new()))
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_defs_new(_: *const libc::c_char,
-                                     raw_parent: *const RsvgNode)
-                                     -> *const RsvgNode {
+pub extern "C" fn rsvg_node_defs_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
     boxed_node_new(NodeType::Defs, raw_parent, Box::new(NodeDefs::new()))
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_switch_new(_: *const libc::c_char,
-                                       raw_parent: *const RsvgNode)
-                                       -> *const RsvgNode {
+pub extern "C" fn rsvg_node_switch_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
     boxed_node_new(NodeType::Switch, raw_parent, Box::new(NodeSwitch::new()))
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_svg_new(_: *const libc::c_char,
-                                    raw_parent: *const RsvgNode)
-                                    -> *const RsvgNode {
+pub extern "C" fn rsvg_node_svg_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
     boxed_node_new(NodeType::Svg, raw_parent, Box::new(NodeSvg::new()))
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_use_new(_: *const libc::c_char,
-                                    raw_parent: *const RsvgNode)
-                                    -> *const RsvgNode {
+pub extern "C" fn rsvg_node_use_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
     boxed_node_new(NodeType::Use, raw_parent, Box::new(NodeUse::new()))
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_symbol_new(_: *const libc::c_char,
-                                       raw_parent: *const RsvgNode)
-                                       -> *const RsvgNode {
+pub extern "C" fn rsvg_node_symbol_new(
+    _: *const libc::c_char,
+    raw_parent: *const RsvgNode,
+) -> *const RsvgNode {
     boxed_node_new(NodeType::Symbol, raw_parent, Box::new(NodeSymbol::new()))
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_node_svg_get_size(raw_node: *const RsvgNode,
-                                         out_width: *mut RsvgLength,
-                                         out_height: *mut RsvgLength) {
+pub extern "C" fn rsvg_node_svg_get_size(
+    raw_node: *const RsvgNode,
+    out_width: *mut RsvgLength,
+    out_height: *mut RsvgLength,
+) {
     assert!(!raw_node.is_null());
     let node: &RsvgNode = unsafe { &*raw_node };
 
@@ -435,9 +466,9 @@ pub extern "C" fn rsvg_node_svg_get_size(raw_node: *const RsvgNode,
     assert!(!out_height.is_null());
 
     node.with_impl(|svg: &NodeSvg| unsafe {
-                       *out_width = svg.w.get();
-                       *out_height = svg.h.get();
-                   });
+        *out_width = svg.w.get();
+        *out_height = svg.h.get();
+    });
 }
 
 #[no_mangle]
@@ -448,19 +479,21 @@ pub extern "C" fn rsvg_node_svg_get_view_box(raw_node: *const RsvgNode) -> RsvgV
     let mut vbox: Option<ViewBox> = None;
 
     node.with_impl(|svg: &NodeSvg| {
-                       vbox = svg.vbox.get();
-                   });
+        vbox = svg.vbox.get();
+    });
 
     RsvgViewBox::from(vbox)
 }
 
 extern "C" {
-    fn rsvg_parse_style_attrs(handle: *const RsvgHandle,
-                              node: *const RsvgNode,
-                              tag: *const libc::c_char,
-                              class: *const libc::c_char,
-                              id: *const libc::c_char,
-                              pbag: *const PropertyBag);
+    fn rsvg_parse_style_attrs(
+        handle: *const RsvgHandle,
+        node: *const RsvgNode,
+        tag: *const libc::c_char,
+        class: *const libc::c_char,
+        id: *const libc::c_char,
+        pbag: *const PropertyBag,
+    );
 }
 
 #[no_mangle]
@@ -469,33 +502,35 @@ pub extern "C" fn rsvg_node_svg_apply_atts(raw_node: *const RsvgNode, handle: *c
     let node: &RsvgNode = unsafe { &*raw_node };
 
     node.with_impl(|svg: &NodeSvg| {
-                       if let Some(owned_pbag) = svg.pbag.borrow().as_ref() {
-                           let pbag = PropertyBag::from_owned(owned_pbag);
-
-                           let mut class = None;
-                           let mut id = None;
-
-                           for (_key, attr, value) in pbag.iter() {
-                               match attr {
-                                   Attribute::Class => class = Some(value),
-
-                                   Attribute::Id => id = Some(value),
-
-                                   _ => (),
-                               }
-                           }
-
-                           let c_class = class.to_glib_none();
-                           let c_id = id.to_glib_none();
-
-                           unsafe {
-                               rsvg_parse_style_attrs(handle,
-                                                      raw_node,
-                                                      str::to_glib_none("svg").0,
-                                                      c_class.0,
-                                                      c_id.0,
-                                                      pbag.ffi());
-                           }
-                       }
-                   });
+        if let Some(owned_pbag) = svg.pbag.borrow().as_ref() {
+            let pbag = PropertyBag::from_owned(owned_pbag);
+
+            let mut class = None;
+            let mut id = None;
+
+            for (_key, attr, value) in pbag.iter() {
+                match attr {
+                    Attribute::Class => class = Some(value),
+
+                    Attribute::Id => id = Some(value),
+
+                    _ => (),
+                }
+            }
+
+            let c_class = class.to_glib_none();
+            let c_id = id.to_glib_none();
+
+            unsafe {
+                rsvg_parse_style_attrs(
+                    handle,
+                    raw_node,
+                    str::to_glib_none("svg").0,
+                    c_class.0,
+                    c_id.0,
+                    pbag.ffi(),
+                );
+            }
+        }
+    });
 }
diff --git a/rsvg_internals/src/text.rs b/rsvg_internals/src/text.rs
index 35bc1dcd..09539f20 100644
--- a/rsvg_internals/src/text.rs
+++ b/rsvg_internals/src/text.rs
@@ -55,8 +55,9 @@ fn create_pango_layout(draw_ctx: *const RsvgDrawingCtx, text: &str) -> pango::La
     font_desc.set_stretch(state::get_font_stretch(state));
 
     let (_, dpi_y) = drawing_ctx::get_dpi(draw_ctx);
-    font_desc.set_size(to_pango_units(drawing_ctx::get_normalized_font_size(draw_ctx) / dpi_y
-                                      * 72.0));
+    font_desc.set_size(to_pango_units(
+        drawing_ctx::get_normalized_font_size(draw_ctx) / dpi_y * 72.0,
+    ));
 
     let layout = pango::Layout::new(&pango_context);
     layout.set_font_description(&font_desc);
@@ -64,9 +65,10 @@ fn create_pango_layout(draw_ctx: *const RsvgDrawingCtx, text: &str) -> pango::La
     let attr_list = pango::AttrList::new();
 
     attr_list.insert(
-        pango::Attribute::new_letter_spacing(
-            to_pango_units(state::get_letter_spacing(state).normalize(draw_ctx))
-        ).unwrap());
+        pango::Attribute::new_letter_spacing(to_pango_units(
+            state::get_letter_spacing(state).normalize(draw_ctx),
+        )).unwrap(),
+    );
 
     if let Some(font_decor) = state::get_font_decor(state) {
         if font_decor.underline {
@@ -81,9 +83,9 @@ fn create_pango_layout(draw_ctx: *const RsvgDrawingCtx, text: &str) -> pango::La
     layout.set_attributes(&attr_list);
 
     layout.set_alignment(match state::get_text_dir(state) {
-                             pango::Direction::Ltr => pango::Alignment::Left,
-                             _ => pango::Alignment::Right,
-                         });
+        pango::Direction::Ltr => pango::Alignment::Left,
+        _ => pango::Alignment::Right,
+    });
 
     layout.set_text(text);
 
@@ -91,9 +93,10 @@ fn create_pango_layout(draw_ctx: *const RsvgDrawingCtx, text: &str) -> pango::La
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_text_create_layout(draw_ctx: *const RsvgDrawingCtx,
-                                          text: *const libc::c_char)
-                                          -> *const pango_sys::PangoLayout {
+pub extern "C" fn rsvg_text_create_layout(
+    draw_ctx: *const RsvgDrawingCtx,
+    text: *const libc::c_char,
+) -> *const pango_sys::PangoLayout {
     assert!(!text.is_null());
     let s = unsafe { utf8_cstr(text) };
     let layout = create_pango_layout(draw_ctx, s);
diff --git a/rsvg_internals/src/transform.rs b/rsvg_internals/src/transform.rs
index ecdfb7cc..2ba8f40a 100644
--- a/rsvg_internals/src/transform.rs
+++ b/rsvg_internals/src/transform.rs
@@ -28,9 +28,10 @@ impl Parse for cairo::Matrix {
 pub fn parse_transform(s: &str) -> Result<cairo::Matrix, AttributeError> {
     let matrix = parse_transform_list(s)?;
 
-    matrix.try_invert()
-          .map(|_| matrix)
-          .map_err(|_| AttributeError::Value("invalid transformation matrix".to_string()))
+    matrix
+        .try_invert()
+        .map(|_| matrix)
+        .map_err(|_| AttributeError::Value("invalid transformation matrix".to_string()))
 }
 
 fn parse_transform_list(s: &str) -> Result<cairo::Matrix, AttributeError> {
@@ -54,7 +55,9 @@ fn parse_transform_list(s: &str) -> Result<cairo::Matrix, AttributeError> {
 }
 
 fn make_expected_function_error() -> AttributeError {
-    AttributeError::from(ParseError::new("expected matrix|translate|scale|rotate|skewX|skewY"))
+    AttributeError::from(ParseError::new(
+        "expected matrix|translate|scale|rotate|skewX|skewY",
+    ))
 }
 
 fn parse_transform_command(parser: &mut Parser) -> Result<cairo::Matrix, AttributeError> {
@@ -70,9 +73,10 @@ fn parse_transform_command(parser: &mut Parser) -> Result<cairo::Matrix, Attribu
     }
 }
 
-fn parse_transform_function(name: &str,
-                            parser: &mut Parser)
-                            -> Result<cairo::Matrix, AttributeError> {
+fn parse_transform_function(
+    name: &str,
+    parser: &mut Parser,
+) -> Result<cairo::Matrix, AttributeError> {
     match name {
         "matrix" => parse_matrix_args(parser),
         "translate" => parse_translate_args(parser),
@@ -85,114 +89,108 @@ fn parse_transform_function(name: &str,
 }
 
 fn parse_matrix_args(parser: &mut Parser) -> Result<cairo::Matrix, AttributeError> {
-    parser.parse_nested_block(|p| {
-                                  let xx = f64::from(p.expect_number()?);
-                                  optional_comma(p);
+    parser
+        .parse_nested_block(|p| {
+            let xx = f64::from(p.expect_number()?);
+            optional_comma(p);
 
-                                  let yx = f64::from(p.expect_number()?);
-                                  optional_comma(p);
+            let yx = f64::from(p.expect_number()?);
+            optional_comma(p);
 
-                                  let xy = f64::from(p.expect_number()?);
-                                  optional_comma(p);
+            let xy = f64::from(p.expect_number()?);
+            optional_comma(p);
 
-                                  let yy = f64::from(p.expect_number()?);
-                                  optional_comma(p);
+            let yy = f64::from(p.expect_number()?);
+            optional_comma(p);
 
-                                  let x0 = f64::from(p.expect_number()?);
-                                  optional_comma(p);
+            let x0 = f64::from(p.expect_number()?);
+            optional_comma(p);
 
-                                  let y0 = f64::from(p.expect_number()?);
+            let y0 = f64::from(p.expect_number()?);
 
-                                  Ok(cairo::Matrix::new(xx, yx, xy, yy, x0, y0))
-                              })
-          .map_err(CssParseError::<()>::basic)
-          .map_err(AttributeError::from)
+            Ok(cairo::Matrix::new(xx, yx, xy, yy, x0, y0))
+        })
+        .map_err(CssParseError::<()>::basic)
+        .map_err(AttributeError::from)
 }
 
 fn parse_translate_args(parser: &mut Parser) -> Result<cairo::Matrix, AttributeError> {
-    parser.parse_nested_block(|p| {
-                                  let tx = f64::from(p.expect_number()?);
-
-                                  let ty = f64::from(p.try(|p| -> Result<f32, CssParseError<()>> {
-                                                               optional_comma(p);
-                                                               Ok(p.expect_number()?)
-                                                           }).unwrap_or(0.0));
-
-                                  Ok(cairo::Matrix::new(1.0, 0.0, 0.0, 1.0, tx, ty))
-                              })
-          .map_err(CssParseError::<()>::basic)
-          .map_err(AttributeError::from)
+    parser
+        .parse_nested_block(|p| {
+            let tx = f64::from(p.expect_number()?);
+
+            let ty = f64::from(p.try(|p| -> Result<f32, CssParseError<()>> {
+                optional_comma(p);
+                Ok(p.expect_number()?)
+            }).unwrap_or(0.0));
+
+            Ok(cairo::Matrix::new(1.0, 0.0, 0.0, 1.0, tx, ty))
+        })
+        .map_err(CssParseError::<()>::basic)
+        .map_err(AttributeError::from)
 }
 
 fn parse_scale_args(parser: &mut Parser) -> Result<cairo::Matrix, AttributeError> {
-    parser.parse_nested_block(|p| {
-                                  let x = f64::from(p.expect_number()?);
-
-                                  let y = p.try(|p| -> Result<f32, CssParseError<()>> {
-                                                    optional_comma(p);
-                                                    Ok(p.expect_number()?)
-                                                }).map(f64::from)
-                                           .unwrap_or(x);
-
-                                  Ok(cairo::Matrix::new(x, 0.0, 0.0, y, 0.0, 0.0))
-                              })
-          .map_err(CssParseError::<()>::basic)
-          .map_err(AttributeError::from)
+    parser
+        .parse_nested_block(|p| {
+            let x = f64::from(p.expect_number()?);
+
+            let y = p.try(|p| -> Result<f32, CssParseError<()>> {
+                optional_comma(p);
+                Ok(p.expect_number()?)
+            }).map(f64::from)
+                .unwrap_or(x);
+
+            Ok(cairo::Matrix::new(x, 0.0, 0.0, y, 0.0, 0.0))
+        })
+        .map_err(CssParseError::<()>::basic)
+        .map_err(AttributeError::from)
 }
 
 fn parse_rotate_args(parser: &mut Parser) -> Result<cairo::Matrix, AttributeError> {
-    parser.parse_nested_block(|p| {
-                                  let angle = f64::from(p.expect_number()?) * PI / 180.0;
-                                  let (s, c) = angle.sin_cos();
-
-                                  let (tx, ty) = p.try(|p| -> Result<_, CssParseError<()>> {
-                                                           optional_comma(p);
-                                                           let tx = f64::from(p.expect_number()?);
-
-                                                           optional_comma(p);
-                                                           let ty = f64::from(p.expect_number()?);
-
-                                                           Ok((tx, ty))
-                                                       }).unwrap_or((0.0, 0.0));
-
-                                  let mut m = cairo::Matrix::new(1.0, 0.0, 0.0, 1.0, tx, ty);
-
-                                  m = cairo::Matrix::multiply(&cairo::Matrix::new(c,
-                                                                                  s,
-                                                                                  -s,
-                                                                                  c,
-                                                                                  0.0,
-                                                                                  0.0),
-                                                              &m);
-                                  m = cairo::Matrix::multiply(&cairo::Matrix::new(1.0,
-                                                                                  0.0,
-                                                                                  0.0,
-                                                                                  1.0,
-                                                                                  -tx,
-                                                                                  -ty),
-                                                              &m);
-                                  Ok(m)
-                              })
-          .map_err(CssParseError::<()>::basic)
-          .map_err(AttributeError::from)
+    parser
+        .parse_nested_block(|p| {
+            let angle = f64::from(p.expect_number()?) * PI / 180.0;
+            let (s, c) = angle.sin_cos();
+
+            let (tx, ty) = p.try(|p| -> Result<_, CssParseError<()>> {
+                optional_comma(p);
+                let tx = f64::from(p.expect_number()?);
+
+                optional_comma(p);
+                let ty = f64::from(p.expect_number()?);
+
+                Ok((tx, ty))
+            }).unwrap_or((0.0, 0.0));
+
+            let mut m = cairo::Matrix::new(1.0, 0.0, 0.0, 1.0, tx, ty);
+
+            m = cairo::Matrix::multiply(&cairo::Matrix::new(c, s, -s, c, 0.0, 0.0), &m);
+            m = cairo::Matrix::multiply(&cairo::Matrix::new(1.0, 0.0, 0.0, 1.0, -tx, -ty), &m);
+            Ok(m)
+        })
+        .map_err(CssParseError::<()>::basic)
+        .map_err(AttributeError::from)
 }
 
 fn parse_skewx_args(parser: &mut Parser) -> Result<cairo::Matrix, AttributeError> {
-    parser.parse_nested_block(|p| {
-                                  let a = f64::from(p.expect_number()?) * PI / 180.0;
-                                  Ok(cairo::Matrix::new(1.0, 0.0, a.tan(), 1.0, 0.0, 0.0))
-                              })
-          .map_err(CssParseError::<()>::basic)
-          .map_err(AttributeError::from)
+    parser
+        .parse_nested_block(|p| {
+            let a = f64::from(p.expect_number()?) * PI / 180.0;
+            Ok(cairo::Matrix::new(1.0, 0.0, a.tan(), 1.0, 0.0, 0.0))
+        })
+        .map_err(CssParseError::<()>::basic)
+        .map_err(AttributeError::from)
 }
 
 fn parse_skewy_args(parser: &mut Parser) -> Result<cairo::Matrix, AttributeError> {
-    parser.parse_nested_block(|p| {
-                                  let a = f64::from(p.expect_number()?) * PI / 180.0;
-                                  Ok(cairo::Matrix::new(1.0, a.tan(), 0.0, 1.0, 0.0, 0.0))
-                              })
-          .map_err(CssParseError::<()>::basic)
-          .map_err(AttributeError::from)
+    parser
+        .parse_nested_block(|p| {
+            let a = f64::from(p.expect_number()?) * PI / 180.0;
+            Ok(cairo::Matrix::new(1.0, a.tan(), 0.0, 1.0, 0.0, 0.0))
+        })
+        .map_err(CssParseError::<()>::basic)
+        .map_err(AttributeError::from)
 }
 
 #[cfg(test)]
@@ -210,9 +208,10 @@ fn make_rotation_matrix(angle_degrees: f64, tx: f64, ty: f64) -> cairo::Matrix {
 }
 
 #[no_mangle]
-pub extern "C" fn rsvg_parse_transform(out_matrix: *mut cairo::Matrix,
-                                       s: *const libc::c_char)
-                                       -> glib_sys::gboolean {
+pub extern "C" fn rsvg_parse_transform(
+    out_matrix: *mut cairo::Matrix,
+    s: *const libc::c_char,
+) -> glib_sys::gboolean {
     assert!(!out_matrix.is_null());
     assert!(!s.is_null());
 
@@ -243,8 +242,10 @@ mod test {
         let r = make_rotation_matrix(30.0, 10.0, 10.0);
 
         let a = cairo::Matrix::multiply(&s, &t);
-        assert_eq!(parse_transform("translate(20, 30), scale (10) rotate (30 10 10)").unwrap(),
-                   cairo::Matrix::multiply(&r, &a));
+        assert_eq!(
+            parse_transform("translate(20, 30), scale (10) rotate (30 10 10)").unwrap(),
+            cairo::Matrix::multiply(&r, &a)
+        );
     }
 
     fn assert_parse_error(s: &str) {
@@ -299,48 +300,72 @@ mod parser_tests {
 
     #[test]
     fn parses_matrix() {
-        assert_eq!(parse_transform("matrix (1 2 3 4 5 6)").unwrap(),
-                   cairo::Matrix::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0));
-
-        assert_eq!(parse_transform("matrix(1,2,3,4 5 6)").unwrap(),
-                   cairo::Matrix::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0));
-
-        assert_eq!(parse_transform("matrix (1,2.25,-3.25e2,4 5 6)").unwrap(),
-                   cairo::Matrix::new(1.0, 2.25, -325.0, 4.0, 5.0, 6.0));
+        assert_eq!(
+            parse_transform("matrix (1 2 3 4 5 6)").unwrap(),
+            cairo::Matrix::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0)
+        );
+
+        assert_eq!(
+            parse_transform("matrix(1,2,3,4 5 6)").unwrap(),
+            cairo::Matrix::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0)
+        );
+
+        assert_eq!(
+            parse_transform("matrix (1,2.25,-3.25e2,4 5 6)").unwrap(),
+            cairo::Matrix::new(1.0, 2.25, -325.0, 4.0, 5.0, 6.0)
+        );
     }
 
     #[test]
     fn parses_translate() {
-        assert_eq!(parse_transform("translate(-1 -2)").unwrap(),
-                   cairo::Matrix::new(1.0, 0.0, 0.0, 1.0, -1.0, -2.0));
-
-        assert_eq!(parse_transform("translate(-1, -2)").unwrap(),
-                   cairo::Matrix::new(1.0, 0.0, 0.0, 1.0, -1.0, -2.0));
-
-        assert_eq!(parse_transform("translate(-1)").unwrap(),
-                   cairo::Matrix::new(1.0, 0.0, 0.0, 1.0, -1.0, 0.0));
+        assert_eq!(
+            parse_transform("translate(-1 -2)").unwrap(),
+            cairo::Matrix::new(1.0, 0.0, 0.0, 1.0, -1.0, -2.0)
+        );
+
+        assert_eq!(
+            parse_transform("translate(-1, -2)").unwrap(),
+            cairo::Matrix::new(1.0, 0.0, 0.0, 1.0, -1.0, -2.0)
+        );
+
+        assert_eq!(
+            parse_transform("translate(-1)").unwrap(),
+            cairo::Matrix::new(1.0, 0.0, 0.0, 1.0, -1.0, 0.0)
+        );
     }
 
     #[test]
     fn parses_scale() {
-        assert_eq!(parse_transform("scale (-1)").unwrap(),
-                   cairo::Matrix::new(-1.0, 0.0, 0.0, -1.0, 0.0, 0.0));
-
-        assert_eq!(parse_transform("scale(-1 -2)").unwrap(),
-                   cairo::Matrix::new(-1.0, 0.0, 0.0, -2.0, 0.0, 0.0));
-
-        assert_eq!(parse_transform("scale(-1, -2)").unwrap(),
-                   cairo::Matrix::new(-1.0, 0.0, 0.0, -2.0, 0.0, 0.0));
+        assert_eq!(
+            parse_transform("scale (-1)").unwrap(),
+            cairo::Matrix::new(-1.0, 0.0, 0.0, -1.0, 0.0, 0.0)
+        );
+
+        assert_eq!(
+            parse_transform("scale(-1 -2)").unwrap(),
+            cairo::Matrix::new(-1.0, 0.0, 0.0, -2.0, 0.0, 0.0)
+        );
+
+        assert_eq!(
+            parse_transform("scale(-1, -2)").unwrap(),
+            cairo::Matrix::new(-1.0, 0.0, 0.0, -2.0, 0.0, 0.0)
+        );
     }
 
     #[test]
     fn parses_rotate() {
-        assert_eq!(parse_transform("rotate (30)").unwrap(),
-                   make_rotation_matrix(30.0, 0.0, 0.0));
-        assert_eq!(parse_transform("rotate (30,-1,-2)").unwrap(),
-                   make_rotation_matrix(30.0, -1.0, -2.0));
-        assert_eq!(parse_transform("rotate(30, -1, -2)").unwrap(),
-                   make_rotation_matrix(30.0, -1.0, -2.0));
+        assert_eq!(
+            parse_transform("rotate (30)").unwrap(),
+            make_rotation_matrix(30.0, 0.0, 0.0)
+        );
+        assert_eq!(
+            parse_transform("rotate (30,-1,-2)").unwrap(),
+            make_rotation_matrix(30.0, -1.0, -2.0)
+        );
+        assert_eq!(
+            parse_transform("rotate(30, -1, -2)").unwrap(),
+            make_rotation_matrix(30.0, -1.0, -2.0)
+        );
     }
 
     fn make_skew_x_matrix(angle_degrees: f64) -> cairo::Matrix {
@@ -357,14 +382,18 @@ mod parser_tests {
 
     #[test]
     fn parses_skew_x() {
-        assert_eq!(parse_transform("skewX (30)").unwrap(),
-                   make_skew_x_matrix(30.0));
+        assert_eq!(
+            parse_transform("skewX (30)").unwrap(),
+            make_skew_x_matrix(30.0)
+        );
     }
 
     #[test]
     fn parses_skew_y() {
-        assert_eq!(parse_transform("skewY (30)").unwrap(),
-                   make_skew_y_matrix(30.0));
+        assert_eq!(
+            parse_transform("skewY (30)").unwrap(),
+            make_skew_y_matrix(30.0)
+        );
     }
 
     #[test]
@@ -373,14 +402,20 @@ mod parser_tests {
         let s = cairo::Matrix::new(10.0, 0.0, 0.0, 10.0, 0.0, 0.0);
         let r = make_rotation_matrix(30.0, 10.0, 10.0);
 
-        assert_eq!(parse_transform("scale(10)rotate(30, 10, 10)").unwrap(),
-                   cairo::Matrix::multiply(&r, &s));
+        assert_eq!(
+            parse_transform("scale(10)rotate(30, 10, 10)").unwrap(),
+            cairo::Matrix::multiply(&r, &s)
+        );
 
-        assert_eq!(parse_transform("translate(20, 30), scale (10)").unwrap(),
-                   cairo::Matrix::multiply(&s, &t));
+        assert_eq!(
+            parse_transform("translate(20, 30), scale (10)").unwrap(),
+            cairo::Matrix::multiply(&s, &t)
+        );
 
         let a = cairo::Matrix::multiply(&s, &t);
-        assert_eq!(parse_transform("translate(20, 30), scale (10) rotate (30 10 10)").unwrap(),
-                   cairo::Matrix::multiply(&r, &a));
+        assert_eq!(
+            parse_transform("translate(20, 30), scale (10) rotate (30 10 10)").unwrap(),
+            cairo::Matrix::multiply(&r, &a)
+        );
     }
 }
diff --git a/rsvg_internals/src/viewbox.rs b/rsvg_internals/src/viewbox.rs
index 8d01d64f..234d8d10 100644
--- a/rsvg_internals/src/viewbox.rs
+++ b/rsvg_internals/src/viewbox.rs
@@ -22,27 +22,37 @@ pub struct ViewBox(pub cairo::Rectangle);
 
 impl ViewBox {
     pub fn new(x: f64, y: f64, w: f64, h: f64) -> ViewBox {
-        assert!(w >= 0.0 && h >= 0.0,
-                "width and height must not be negative");
-
-        ViewBox(cairo::Rectangle { x,
-                                   y,
-                                   width: w,
-                                   height: h, })
+        assert!(
+            w >= 0.0 && h >= 0.0,
+            "width and height must not be negative"
+        );
+
+        ViewBox(cairo::Rectangle {
+            x,
+            y,
+            width: w,
+            height: h,
+        })
     }
 }
 
 impl From<Option<ViewBox>> for RsvgViewBox {
     fn from(v: Option<ViewBox>) -> RsvgViewBox {
         if let Some(vb) = v {
-            RsvgViewBox { rect: vb.0,
-                          active: true.to_glib(), }
+            RsvgViewBox {
+                rect: vb.0,
+                active: true.to_glib(),
+            }
         } else {
-            RsvgViewBox { rect: cairo::Rectangle { x: 0.0,
-                                                   y: 0.0,
-                                                   width: 0.0,
-                                                   height: 0.0, },
-                          active: false.to_glib(), }
+            RsvgViewBox {
+                rect: cairo::Rectangle {
+                    x: 0.0,
+                    y: 0.0,
+                    width: 0.0,
+                    height: 0.0,
+                },
+                active: false.to_glib(),
+            }
         }
     }
 }
@@ -60,18 +70,22 @@ impl Parse for ViewBox {
     //
     // Where w and h must be nonnegative.
     fn parse(s: &str, _: ()) -> Result<ViewBox, AttributeError> {
-        let v = parsers::number_list (s, ListLength::Exact (4))
-            .map_err (|_| ParseError::new ("string does not match 'x [,] y [,] w [,] h'"))?;
+        let v = parsers::number_list(s, ListLength::Exact(4))
+            .map_err(|_| ParseError::new("string does not match 'x [,] y [,] w [,] h'"))?;
 
         let (x, y, w, h) = (v[0], v[1], v[2], v[3]);
 
         if w >= 0.0 && h >= 0.0 {
-            Ok(ViewBox(cairo::Rectangle { x,
-                                          y,
-                                          width: w,
-                                          height: h, }))
+            Ok(ViewBox(cairo::Rectangle {
+                x,
+                y,
+                width: w,
+                height: h,
+            }))
         } else {
-            Err(AttributeError::Value("width and height must not be negative".to_string()))
+            Err(AttributeError::Value(
+                "width and height must not be negative".to_string(),
+            ))
         }
     }
 }
@@ -82,11 +96,15 @@ mod tests {
 
     #[test]
     fn parses_valid_viewboxes() {
-        assert_eq!(ViewBox::parse("  1 2 3 4", ()),
-                   Ok(ViewBox::new(1.0, 2.0, 3.0, 4.0)));
-
-        assert_eq!(ViewBox::parse(" -1.5 -2.5e1,34,56e2  ", ()),
-                   Ok(ViewBox::new(-1.5, -25.0, 34.0, 5600.0)));
+        assert_eq!(
+            ViewBox::parse("  1 2 3 4", ()),
+            Ok(ViewBox::new(1.0, 2.0, 3.0, 4.0))
+        );
+
+        assert_eq!(
+            ViewBox::parse(" -1.5 -2.5e1,34,56e2  ", ()),
+            Ok(ViewBox::new(-1.5, -25.0, 34.0, 5600.0))
+        );
     }
 
     #[test]
diff --git a/rsvg_internals/src/viewport.rs b/rsvg_internals/src/viewport.rs
index 3b329e58..2cdb0636 100644
--- a/rsvg_internals/src/viewport.rs
+++ b/rsvg_internals/src/viewport.rs
@@ -13,32 +13,36 @@ pub enum ClipMode {
     ClipToVbox,
 }
 
-pub fn draw_in_viewport<F>(vx: f64,
-                           vy: f64,
-                           vw: f64,
-                           vh: f64,
-                           clip_mode: ClipMode,
-                           do_clip: bool,
-                           vbox: Option<ViewBox>,
-                           preserve_aspect_ratio: AspectRatio,
-                           affine: cairo::Matrix,
-                           draw_ctx: *const RsvgDrawingCtx,
-                           draw_fn: F)
-    where F: FnOnce()
+pub fn draw_in_viewport<F>(
+    vx: f64,
+    vy: f64,
+    vw: f64,
+    vh: f64,
+    clip_mode: ClipMode,
+    do_clip: bool,
+    vbox: Option<ViewBox>,
+    preserve_aspect_ratio: AspectRatio,
+    affine: cairo::Matrix,
+    draw_ctx: *const RsvgDrawingCtx,
+    draw_fn: F,
+) where
+    F: FnOnce(),
 {
     let mut ctx = RsvgDrawingCtxWrapper(draw_ctx);
 
-    in_viewport(&mut ctx,
-                vx,
-                vy,
-                vw,
-                vh,
-                clip_mode,
-                do_clip,
-                vbox,
-                preserve_aspect_ratio,
-                affine,
-                draw_fn);
+    in_viewport(
+        &mut ctx,
+        vx,
+        vy,
+        vw,
+        vh,
+        clip_mode,
+        do_clip,
+        vbox,
+        preserve_aspect_ratio,
+        affine,
+        draw_fn,
+    );
 }
 
 trait ViewportCtx {
@@ -78,18 +82,20 @@ impl ViewportCtx for RsvgDrawingCtxWrapper {
     }
 }
 
-fn in_viewport<F>(ctx: &mut ViewportCtx,
-                  vx: f64,
-                  vy: f64,
-                  vw: f64,
-                  vh: f64,
-                  clip_mode: ClipMode,
-                  do_clip: bool,
-                  vbox: Option<ViewBox>,
-                  preserve_aspect_ratio: AspectRatio,
-                  mut affine: cairo::Matrix,
-                  draw_fn: F)
-    where F: FnOnce()
+fn in_viewport<F>(
+    ctx: &mut ViewportCtx,
+    vx: f64,
+    vy: f64,
+    vw: f64,
+    vh: f64,
+    clip_mode: ClipMode,
+    do_clip: bool,
+    vbox: Option<ViewBox>,
+    preserve_aspect_ratio: AspectRatio,
+    mut affine: cairo::Matrix,
+    draw_fn: F,
+) where
+    F: FnOnce(),
 {
     // width or height set to 0 disables rendering of the element
     // https://www.w3.org/TR/SVG/struct.html#SVGElementWidthAttribute
@@ -184,27 +190,31 @@ mod tests {
         }
     }
 
-    fn call_in_viewport(vx: f64,
-                        vy: f64,
-                        vw: f64,
-                        vh: f64,
-                        clip_mode: ClipMode,
-                        do_clip: bool,
-                        vbox: Option<ViewBox>,
-                        preserve_aspect_ratio: AspectRatio,
-                        affine: cairo::Matrix,
-                        ctx: &mut Ctx) {
-        in_viewport(ctx,
-                    vx,
-                    vy,
-                    vw,
-                    vh,
-                    clip_mode,
-                    do_clip,
-                    vbox,
-                    preserve_aspect_ratio,
-                    affine,
-                    || ());
+    fn call_in_viewport(
+        vx: f64,
+        vy: f64,
+        vw: f64,
+        vh: f64,
+        clip_mode: ClipMode,
+        do_clip: bool,
+        vbox: Option<ViewBox>,
+        preserve_aspect_ratio: AspectRatio,
+        affine: cairo::Matrix,
+        ctx: &mut Ctx,
+    ) {
+        in_viewport(
+            ctx,
+            vx,
+            vy,
+            vw,
+            vh,
+            clip_mode,
+            do_clip,
+            vbox,
+            preserve_aspect_ratio,
+            affine,
+            || (),
+        );
 
         assert_eq!(ctx.view_box_size, ctx.expected_view_box_size);
         assert_eq!(ctx.clipping_rect, ctx.expected_clipping_rect);
@@ -216,27 +226,33 @@ mod tests {
         let mut affine = cairo::Matrix::identity();
         affine.scale(0.20, 0.20);
 
-        let mut ctx = Ctx { view_box_size: None,
-                            clipping_rect: None,
-                            affine: None,
-
-                            expected_view_box_size: Some((50.0, 50.0)),
-                            expected_clipping_rect: Some((10.0, 10.0, 10.0, 10.0)),
-                            expected_affine: Some(affine), };
-
-        call_in_viewport(10.0,
-                         10.0,
-                         10.0,
-                         10.0,
-                         ClipMode::ClipToViewport,
-                         true,
-                         Some(ViewBox(cairo::Rectangle { x: 50.0,
-                                                         y: 50.0,
-                                                         width: 50.0,
-                                                         height: 50.0, })),
-                         AspectRatio::parse("xMidYMid meet", ()).unwrap(),
-                         cairo::Matrix::identity(),
-                         &mut ctx);
+        let mut ctx = Ctx {
+            view_box_size: None,
+            clipping_rect: None,
+            affine: None,
+
+            expected_view_box_size: Some((50.0, 50.0)),
+            expected_clipping_rect: Some((10.0, 10.0, 10.0, 10.0)),
+            expected_affine: Some(affine),
+        };
+
+        call_in_viewport(
+            10.0,
+            10.0,
+            10.0,
+            10.0,
+            ClipMode::ClipToViewport,
+            true,
+            Some(ViewBox(cairo::Rectangle {
+                x: 50.0,
+                y: 50.0,
+                width: 50.0,
+                height: 50.0,
+            })),
+            AspectRatio::parse("xMidYMid meet", ()).unwrap(),
+            cairo::Matrix::identity(),
+            &mut ctx,
+        );
     }
 
     #[test]
@@ -245,26 +261,32 @@ mod tests {
         affine.translate(10.0, 10.0);
         affine.scale(0.40, 0.40);
 
-        let mut ctx = Ctx { view_box_size: None,
-                            clipping_rect: None,
-                            affine: None,
-
-                            expected_view_box_size: Some((50.0, 50.0)),
-                            expected_clipping_rect: Some((0.0, 0.0, 50.0, 50.0)),
-                            expected_affine: Some(affine), };
-
-        call_in_viewport(10.0,
-                         10.0,
-                         20.0,
-                         20.0,
-                         ClipMode::ClipToVbox,
-                         true,
-                         Some(ViewBox(cairo::Rectangle { x: 0.0,
-                                                         y: 0.0,
-                                                         width: 50.0,
-                                                         height: 50.0, })),
-                         AspectRatio::parse("xMidYMid meet", ()).unwrap(),
-                         cairo::Matrix::identity(),
-                         &mut ctx);
+        let mut ctx = Ctx {
+            view_box_size: None,
+            clipping_rect: None,
+            affine: None,
+
+            expected_view_box_size: Some((50.0, 50.0)),
+            expected_clipping_rect: Some((0.0, 0.0, 50.0, 50.0)),
+            expected_affine: Some(affine),
+        };
+
+        call_in_viewport(
+            10.0,
+            10.0,
+            20.0,
+            20.0,
+            ClipMode::ClipToVbox,
+            true,
+            Some(ViewBox(cairo::Rectangle {
+                x: 0.0,
+                y: 0.0,
+                width: 50.0,
+                height: 50.0,
+            })),
+            AspectRatio::parse("xMidYMid meet", ()).unwrap(),
+            cairo::Matrix::identity(),
+            &mut ctx,
+        );
     }
 }


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