[librsvg: 5/9] Normalize comments.



commit 29cb0ca59d6314f92b229376418269f8901651ca
Author: Jordan Petridis <jordanpetridis protonmail com>
Date:   Wed Feb 28 15:11:42 2018 +0200

    Normalize comments.

 .rustfmt.toml                      |   2 +-
 rsvg_internals/src/aspect_ratio.rs |  60 ++++------
 rsvg_internals/src/bbox.rs         |  17 ++-
 rsvg_internals/src/color.rs        |  29 ++---
 rsvg_internals/src/coord_units.rs  |   6 +-
 rsvg_internals/src/error.rs        |  16 +--
 rsvg_internals/src/gradient.rs     |  34 +++---
 rsvg_internals/src/image.rs        |  20 ++--
 rsvg_internals/src/length.rs       | 182 ++++++++++++----------------
 rsvg_internals/src/link.rs         |   3 +-
 rsvg_internals/src/marker.rs       | 235 ++++++++++++++++---------------------
 rsvg_internals/src/mask.rs         |  20 ++--
 rsvg_internals/src/node.rs         |  21 ++--
 rsvg_internals/src/opacity.rs      |  18 +--
 rsvg_internals/src/paint_server.rs |   8 +-
 rsvg_internals/src/path_builder.rs |  26 ++--
 rsvg_internals/src/path_parser.rs  |  62 ++++------
 rsvg_internals/src/shapes.rs       |  57 ++++-----
 rsvg_internals/src/structure.rs    |  41 +++----
 rsvg_internals/src/viewbox.rs      |   2 +-
 20 files changed, 345 insertions(+), 514 deletions(-)
---
diff --git a/.rustfmt.toml b/.rustfmt.toml
index 79bf0104..c483a370 100644
--- a/.rustfmt.toml
+++ b/.rustfmt.toml
@@ -10,7 +10,7 @@ newline_style = "Unix"
 write_mode = "Overwrite"
 condense_wildcard_suffixes = false
 format_strings = true
-# normalize_comments = true
+normalize_comments = true
 reorder_imports = true
 reorder_imported_names = true
 reorder_imports_in_group = true
diff --git a/rsvg_internals/src/aspect_ratio.rs b/rsvg_internals/src/aspect_ratio.rs
index 32490ff4..ff5fb7a3 100644
--- a/rsvg_internals/src/aspect_ratio.rs
+++ b/rsvg_internals/src/aspect_ratio.rs
@@ -160,42 +160,24 @@ impl Default for AspectRatio {
 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,
     }
 }
@@ -281,10 +263,8 @@ impl Parse for AspectRatio {
         Ok(AspectRatio { defer,
                          align: match align {
                              Align::None => Align::None,
-                             Align::Aligned { align, .. } => {
-                                 Align::Aligned { align,
-                                                  fit: fit_mode, }
-                             }
+                             Align::Aligned { align, .. } => Align::Aligned { align,
+                                                                              fit: fit_mode, },
                          }, })
     }
 }
diff --git a/rsvg_internals/src/bbox.rs b/rsvg_internals/src/bbox.rs
index ada8b041..73b570b2 100644
--- a/rsvg_internals/src/bbox.rs
+++ b/rsvg_internals/src/bbox.rs
@@ -5,7 +5,7 @@ use cairo::MatrixTrait;
 use glib::translate::*;
 use util::*;
 
-/* Keep this in sync with ../../rsvg-private.h:RsvgBbox */
+// Keep this in sync with ../../rsvg-private.h:RsvgBbox
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub struct RsvgBbox {
@@ -59,13 +59,12 @@ pub extern "C" fn rsvg_bbox_insert(raw_dst: *mut RsvgBbox, raw_src: *const RsvgB
     affine.invert(); // this will panic!() if it's not invertible... should we check on our own?
     affine = cairo::Matrix::multiply(&src.affine, &affine);
 
-    /* This is a trick.  We want to transform each of the corners of
-     * the rectangle defined by src.rect with the affine
-     * transformation, and get the bounding box of all the four
-     * resulting points.  The modulus and division accomplish this by
-     * running through all the combinations of adding or not adding
-     * the width/height to the first point src.rect.(x, y).
-     */
+    // This is a trick.  We want to transform each of the corners of
+    // the rectangle defined by src.rect with the affine
+    // transformation, and get the bounding box of all the four
+    // resulting points.  The modulus and division accomplish this by
+    // running through all the combinations of adding or not adding
+    // the width/height to the first point src.rect.(x, y).
     for i in 0..4 {
         let rx: f64 = src.rect.x + src.rect.width * f64::from(i % 2);
         let ry: f64 = src.rect.y + src.rect.height * f64::from(i / 2);
@@ -123,7 +122,7 @@ pub extern "C" fn rsvg_bbox_clip(raw_dst: *mut RsvgBbox, raw_src: *const RsvgBbo
     affine.invert();
     affine = cairo::Matrix::multiply(&src.affine, &affine);
 
-    /* This is a trick.  See rsvg_bbox_insert() for a description of how it works. */
+    // This is a trick.  See rsvg_bbox_insert() for a description of how it works.
     for i in 0..4 {
         let rx: f64 = src.rect.x + src.rect.width * f64::from(i % 2);
         let ry: f64 = src.rect.y + src.rect.height * f64::from(i / 2);
diff --git a/rsvg_internals/src/color.rs b/rsvg_internals/src/color.rs
index 50a69e31..a24c0718 100644
--- a/rsvg_internals/src/color.rs
+++ b/rsvg_internals/src/color.rs
@@ -136,27 +136,20 @@ 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::Inherit) => ColorSpec { kind: ColorKind::Inherit,
+                                              argb: 0, },
 
-            Ok(Color::CurrentColor) => {
-                ColorSpec { kind: ColorKind::CurrentColor,
-                            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)), }
-            }
+            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, }
-            }
+            _ => ColorSpec { kind: ColorKind::ParseError,
+                             argb: 0, },
         }
     }
 }
diff --git a/rsvg_internals/src/coord_units.rs b/rsvg_internals/src/coord_units.rs
index feaa7cb7..7fd7199e 100644
--- a/rsvg_internals/src/coord_units.rs
+++ b/rsvg_internals/src/coord_units.rs
@@ -21,10 +21,8 @@ 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'"))),
         }
     }
 }
diff --git a/rsvg_internals/src/error.rs b/rsvg_internals/src/error.rs
index cb9e7420..4ca02106 100644
--- a/rsvg_internals/src/error.rs
+++ b/rsvg_internals/src/error.rs
@@ -49,17 +49,13 @@ 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 4a10f9df..5f43b9cc 100644
--- a/rsvg_internals/src/gradient.rs
+++ b/rsvg_internals/src/gradient.rs
@@ -27,10 +27,9 @@ struct ColorStop {
 
 coord_units!(GradientUnits, CoordUnits::ObjectBoundingBox);
 
-/* Any of the attributes in gradient elements may be omitted.  In turn, the missing
- * ones can be inherited from the gradient referenced by its "fallback" IRI.  We
- * represent these possibly-missing attributes as Option<foo>.
- */
+// Any of the attributes in gradient elements may be omitted.  In turn, the missing
+// ones can be inherited from the gradient referenced by its "fallback" IRI.  We
+// represent these possibly-missing attributes as Option<foo>.
 #[derive(Clone)]
 struct GradientCommon {
     pub units: Option<GradientUnits>,
@@ -208,8 +207,7 @@ impl GradientVariant {
     }
 
     fn resolve_from_defaults(&mut self) {
-        /* These are per the spec */
-
+        // These are per the spec
         match *self {
             GradientVariant::Linear { .. } => {
                 self.resolve_from_fallback(&GradientVariant::default_linear())
@@ -455,10 +453,9 @@ fn set_linear_gradient_on_pattern(gradient: &Gradient,
     true
 }
 
-/* SVG defines radial gradients as being inside a circle (cx, cy, radius).  The
- * gradient projects out from a focus point (fx, fy), which is assumed to be
- * inside the circle, to the edge of the circle. */
-//
+// SVG defines radial gradients as being inside a circle (cx, cy, radius).  The
+// gradient projects out from a focus point (fx, fy), which is assumed to be
+// inside the circle, to the edge of the circle.
 // The description of https://www.w3.org/TR/SVG/pservers.html#RadialGradientElement
 // states:
 //
@@ -468,40 +465,37 @@ fn set_linear_gradient_on_pattern(gradient: &Gradient,
 // defined by ‘cx’, ‘cy’ and ‘r’.
 //
 // So, let's do that!
-//
 fn fix_focus_point(mut fx: f64, mut fy: f64, cx: f64, cy: f64, radius: f64) -> (f64, f64) {
-    /* Easy case first: the focus point is inside the circle */
+    // Easy case first: the focus point is inside the circle
 
     if (fx - cx) * (fx - cx) + (fy - cy) * (fy - cy) <= radius * radius {
         return (fx, fy);
     }
 
-    /* Hard case: focus point is outside the circle. */
-    //
+    // Hard case: focus point is outside the circle.
     // First, translate everything to the origin.
-    //
 
     fx -= cx;
     fy -= cy;
 
-    /* Find the vector from the origin to (fx, fy) */
+    // Find the vector from the origin to (fx, fy)
 
     let mut vx = fx;
     let mut vy = fy;
 
-    /* Find the vector's magnitude */
+    // Find the vector's magnitude
 
     let mag = (vx * vx + vy * vy).sqrt();
 
-    /* Normalize the vector to have a magnitude equal to radius; (vx, vy) will now be on the
-     * edge of the circle */
+    // Normalize the vector to have a magnitude equal to radius; (vx, vy) will now be on the
+    // edge of the circle
 
     let scale = mag / radius;
 
     vx /= scale;
     vy /= scale;
 
-    /* Translate back to (cx, cy) and we are done! */
+    // Translate back to (cx, cy) and we are done!
 
     (vx + cx, vy + cy)
 }
diff --git a/rsvg_internals/src/image.rs b/rsvg_internals/src/image.rs
index 8ab643c6..b1394008 100644
--- a/rsvg_internals/src/image.rs
+++ b/rsvg_internals/src/image.rs
@@ -44,18 +44,14 @@ 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)?)
diff --git a/rsvg_internals/src/length.rs b/rsvg_internals/src/length.rs
index d64c55e6..f47c8cf5 100644
--- a/rsvg_internals/src/length.rs
+++ b/rsvg_internals/src/length.rs
@@ -15,7 +15,7 @@ use parsers::Parse;
 use parsers::ParseError;
 use util::utf8_cstr;
 
-/* Keep this in sync with ../../rsvg-private.h:LengthUnit */
+// Keep this in sync with ../../rsvg-private.h:LengthUnit
 #[repr(C)]
 #[derive(Debug, PartialEq, Copy, Clone)]
 pub enum LengthUnit {
@@ -28,7 +28,7 @@ pub enum LengthUnit {
     RelativeSmaller,
 }
 
-/* Keep this in sync with ../../rsvg-private.h:LengthDir */
+// Keep this in sync with ../../rsvg-private.h:LengthDir
 #[repr(C)]
 #[derive(Debug, PartialEq, Copy, Clone)]
 pub enum LengthDir {
@@ -37,11 +37,11 @@ pub enum LengthDir {
     Both,
 }
 
-/* This is *not* an opaque struct; it is actually visible to the C code.  It is so
- * that the remaining C code can create RsvgLength values as part of existing
- * structures or objects, without allocations on the heap.
- */
-/* Keep this in sync with ../../rsvg-private.h:RsvgLength */
+// This is *not* an opaque struct; it is actually visible to the C code.  It is so
+// that the remaining C code can create RsvgLength values as part of existing
+// structures or objects, without allocations on the heap.
+//
+// Keep this in sync with ../../rsvg-private.h:RsvgLength
 #[repr(C)]
 #[derive(Debug, PartialEq, Copy, Clone)]
 pub struct RsvgLength {
@@ -104,9 +104,8 @@ pub extern "C" fn rsvg_length_parse(string: *const libc::c_char, dir: LengthDir)
     RsvgLength::parse(my_string, dir).unwrap_or_else(|_| RsvgLength::default())
 }
 
-/* https://www.w3.org/TR/SVG/types.html#DataTypeLength
- * https://www.w3.org/TR/2008/REC-CSS2-20080411/syndata.html#length-units */
-//
+// https://www.w3.org/TR/SVG/types.html#DataTypeLength
+// https://www.w3.org/TR/2008/REC-CSS2-20080411/syndata.html#length-units
 // Lengths have units.  When they need to be need resolved to
 // units in the user's coordinate system, some unit types
 // need to know if they are horizontal/vertical/both.  For example,
@@ -114,7 +113,6 @@ pub extern "C" fn rsvg_length_parse(string: *const libc::c_char, dir: LengthDir)
 // viewport's width.  In this case, the @dir argument is used
 // inside RsvgLength::normalize(), when it needs to know to what the
 // length refers.
-//
 
 fn make_err() -> AttributeError {
     AttributeError::Parse(ParseError::new("expected length: number(\"em\" | \"ex\" | \"px\" | \
@@ -214,99 +212,72 @@ impl RsvgLength {
                 .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, .. } => {
                     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()),
                     }
                 }
 
                 // 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, }
-                        }
-
-                        "xx-small" | "x-small" | "small" | "medium" | "large" | "x-large"
-                        | "xx-large" => {
-                            RsvgLength { length: compute_named_size(cow),
-                                         unit: LengthUnit::Inch,
-                                         dir, }
-                        }
+                Token::Ident(ref cow) => match cow.as_ref() {
+                    "larger" => RsvgLength { length: 0.0,
+                                             unit: LengthUnit::RelativeLarger,
+                                             dir, },
 
-                        _ => return Err(make_err()),
-                    }
-                }
+                    "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, },
+
+                    _ => return Err(make_err()),
+                },
 
                 _ => return Err(make_err()),
             }
@@ -317,12 +288,10 @@ impl RsvgLength {
 }
 
 fn viewport_percentage(x: f64, y: f64) -> f64 {
-    /* https://www.w3.org/TR/SVG/coords.html#Units */
-    //
+    // https://www.w3.org/TR/SVG/coords.html#Units
     // "For any other length value expressed as a percentage of the viewport, the
     // percentage is calculated as the specified percentage of
     // sqrt((actual-width)**2 + (actual-height)**2))/sqrt(2)."
-    //
     (x * x + y * y).sqrt() / SQRT_2
 }
 
@@ -426,17 +395,14 @@ 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::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::Inherit) => RsvgStrokeDasharray { kind:
+                                                                  RsvgStrokeDasharrayKind::Inherit,
+                                                              num_dashes: 0,
+                                                              dashes: ptr::null_mut(), },
 
         Ok(StrokeDasharray::Dasharray(ref v)) => {
             RsvgStrokeDasharray { kind: RsvgStrokeDasharrayKind::Dashes,
@@ -444,11 +410,9 @@ pub extern "C" fn rsvg_parse_stroke_dasharray(string: *const libc::c_char) -> Rs
                                   dashes: to_c_array(v), }
         }
 
-        Err(_) => {
-            RsvgStrokeDasharray { kind: RsvgStrokeDasharrayKind::Error,
-                                  num_dashes: 0,
-                                  dashes: ptr::null_mut(), }
-        }
+        Err(_) => RsvgStrokeDasharray { kind: RsvgStrokeDasharrayKind::Error,
+                                        num_dashes: 0,
+                                        dashes: ptr::null_mut(), },
     }
 }
 
diff --git a/rsvg_internals/src/link.rs b/rsvg_internals/src/link.rs
index 01572f91..af44df97 100644
--- a/rsvg_internals/src/link.rs
+++ b/rsvg_internals/src/link.rs
@@ -114,8 +114,7 @@ impl CairoTagging for cairo::Context {
     }
 }
 
-/***** C Prototypes **** * * * * * * * * * * **/
-
+// ****************** C Prototypes  ******************
 #[no_mangle]
 pub extern "C" fn rsvg_node_link_new(_: *const libc::c_char,
                                      raw_parent: *const RsvgNode)
diff --git a/rsvg_internals/src/marker.rs b/rsvg_internals/src/marker.rs
index d71b7cdf..0e80ed69 100644
--- a/rsvg_internals/src/marker.rs
+++ b/rsvg_internals/src/marker.rs
@@ -22,7 +22,6 @@ use util::*;
 use viewbox::*;
 
 // markerUnits attribute: https://www.w3.org/TR/SVG/painting.html#MarkerElement
-
 #[derive(Debug, Copy, Clone, PartialEq)]
 enum MarkerUnits {
     UserSpaceOnUse,
@@ -43,16 +42,13 @@ 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\""))),
         }
     }
 }
 
 // orient attribute: https://www.w3.org/TR/SVG/painting.html#MarkerElement
-
 #[derive(Debug, Copy, Clone, PartialEq)]
 enum MarkerOrient {
     Auto,
@@ -72,16 +68,13 @@ 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),
         }
     }
 }
 
 // NodeMarker
-
 struct NodeMarker {
     units: Cell<MarkerUnits>,
     ref_x: Cell<RsvgLength>,
@@ -202,19 +195,15 @@ impl NodeTrait for NodeMarker {
 
                 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)?),
 
@@ -248,7 +237,6 @@ pub extern "C" fn rsvg_node_marker_new(_: *const libc::c_char,
 }
 
 // Machinery to figure out marker orientations
-
 #[derive(Debug, PartialEq)]
 pub enum Segment {
     Degenerate {
@@ -276,8 +264,7 @@ enum SegmentState {
     ClosedSubpath,
 }
 
-/* This converts a cairo_path_t into a list of curveto-like segments.  Each segment can be: */
-//
+// This converts a cairo_path_t into a list of curveto-like segments.  Each segment can be:
 // 1. Segment::Degenerate => the segment is actually a single point (x, y)
 //
 // 2. Segment::LineOrCurve => either a lineto or a curveto (or the effective lineto that results
@@ -292,8 +279,6 @@ enum SegmentState {
 //    The tangent at the end point is given by the vector (P4 - P3).
 // The tangents also work if the segment refers to a lineto (they will both just point in the
 // same direction).
-//
-
 fn make_degenerate(x: f64, y: f64) -> Segment {
     Segment::Degenerate { x, y }
 }
@@ -345,33 +330,29 @@ pub fn path_builder_to_segments(builder: &RsvgPathBuilder) -> Vec<Segment> {
 
                 match state {
                     SegmentState::Initial | SegmentState::InSubpath => {
-                        /* Ignore the very first moveto in a sequence (Initial state), or if we
-                         * were already drawing within a subpath, start
-                         * a new subpath.
-                         */
+                        // Ignore the very first moveto in a sequence (Initial state), or if we
+                        // were already drawing within a subpath, start
+                        // a new subpath.
                         state = SegmentState::NewSubpath;
                     }
 
                     SegmentState::NewSubpath => {
-                        /* We had just begun a new subpath (i.e. from a moveto) and we got
-                         * another moveto?  Output a stray point for the
-                         * previous moveto.
-                         */
+                        // We had just begun a new subpath (i.e. from a moveto) and we got
+                        // another moveto?  Output a stray point for the
+                        // previous moveto.
                         segments.push(make_degenerate(last_x, last_y));
                         state = SegmentState::NewSubpath;
                     }
 
                     SegmentState::ClosedSubpath => {
-                        /* Cairo outputs a moveto after every closepath, so that subsequent
-                         * lineto/curveto commands will start at the closed vertex. */
-                        //
+                        // Cairo outputs a moveto after every closepath, so that subsequent
+                        // lineto/curveto commands will start at the closed vertex.
                         // We don't want to actually emit a point (a degenerate segment) in that
                         // artificial-moveto case.
                         //
                         // We'll reset to the Initial state so that a subsequent "real" moveto will
                         // be handled as the beginning of a new subpath, or a degenerate point, as
                         // usual.
-                        //
                         state = SegmentState::Initial;
                     }
                 }
@@ -419,12 +400,11 @@ fn points_equal(x1: f64, y1: f64, x2: f64, y2: f64) -> bool {
     double_equals(x1, x2) && double_equals(y1, y2)
 }
 
-/* If the segment has directionality, returns two vectors (v1x, v1y, v2x, v2y); otherwise,
- * returns None.  The vectors are the tangents at the beginning and at the end of the segment,
- * respectively.  A segment does not have directionality if it is degenerate (i.e. a single
- * point) or a zero-length segment, i.e. where all four control points are coincident (the first
- * and last control points may coincide, but the others may define a loop - thus nonzero length)
- */
+// If the segment has directionality, returns two vectors (v1x, v1y, v2x, v2y); otherwise,
+// returns None.  The vectors are the tangents at the beginning and at the end of the segment,
+// respectively.  A segment does not have directionality if it is degenerate (i.e. a single
+// point) or a zero-length segment, i.e. where all four control points are coincident (the first
+// and last control points may coincide, but the others may define a loop - thus nonzero length)
 fn get_segment_directionalities(segment: &Segment) -> Option<(f64, f64, f64, f64)> {
     match *segment {
         Segment::Degenerate { .. } => None,
@@ -463,8 +443,7 @@ fn get_segment_directionalities(segment: &Segment) -> Option<(f64, f64, f64, f64
     }
 }
 
-/* The SVG spec 1.1 says http://www.w3.org/TR/SVG/implnote.html#PathElementImplementationNotes */
-//
+// The SVG spec 1.1 says http://www.w3.org/TR/SVG/implnote.html#PathElementImplementationNotes
 // Certain line-capping and line-joining situations and markers
 // require that a path segment have directionality at its start and
 // end points. Zero-length path segments have no directionality. In
@@ -488,27 +467,27 @@ 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) {
-    /* "go backwards ... within the current subpath until ... segment which has directionality
-     * at its end point" */
-
+    // "go backwards ... within the current subpath until ... segment which has directionality
+    // at its end point"
     for segment in segments[..start_index + 1].iter().rev() {
         match *segment {
             Segment::Degenerate { .. } => {
-                return (false, 0.0, 0.0); /* reached the beginning of the subpath as we ran into a 
standalone point */
+                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;
+                    }
                 }
-            },
+            }
         }
     }
 
@@ -518,23 +497,24 @@ fn find_incoming_directionality_backwards(segments: &[Segment],
 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" */
-
+    // "go forwards ... within the current subpath until ... segment which has directionality at
+    // its start point"
     for segment in &segments[start_index..] {
         match *segment {
             Segment::Degenerate { .. } => {
-                return (false, 0.0, 0.0); /* reached the end of a subpath as we ran into a standalone point 
*/
+                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;
+                    }
                 }
-            },
+            }
         }
     }
 
@@ -645,12 +625,10 @@ fn emit_marker<E>(segment: &Segment,
     let (x, y) = match *segment {
         Segment::Degenerate { x, y } => (x, y),
 
-        Segment::LineOrCurve { x1, y1, x4, y4, .. } => {
-            match endpoint {
-                MarkerEndpoint::Start => (x1, y1),
-                MarkerEndpoint::End => (x4, y4),
-            }
-        }
+        Segment::LineOrCurve { x1, y1, x4, y4, .. } => match endpoint {
+            MarkerEndpoint::Start => (x1, y1),
+            MarkerEndpoint::End => (x4, y4),
+        },
     };
 
     emit_fn(marker_type, x, y, orient);
@@ -700,7 +678,7 @@ fn emit_markers_for_path_builder<E>(builder: &RsvgPathBuilder, emit_fn: &mut E)
         InSubpath,
     };
 
-    /* Convert the path to a list of segments and bare points */
+    // Convert the path to a list of segments and bare points
     let segments = path_builder_to_segments(builder);
 
     let mut subpath_state = SubpathState::NoSubpath;
@@ -711,8 +689,7 @@ fn emit_markers_for_path_builder<E>(builder: &RsvgPathBuilder, emit_fn: &mut E)
                 if let SubpathState::InSubpath = subpath_state {
                     assert!(i > 0);
 
-                    /* Got a lone point after a subpath; render the subpath's end marker first */
-
+                    // 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],
@@ -722,7 +699,7 @@ fn emit_markers_for_path_builder<E>(builder: &RsvgPathBuilder, emit_fn: &mut E)
                                 emit_fn);
                 }
 
-                /* Render marker for the lone point; no directionality */
+                // Render marker for the lone point; no directionality
                 emit_marker(segment,
                             MarkerEndpoint::Start,
                             MarkerType::Middle,
@@ -733,8 +710,7 @@ fn emit_markers_for_path_builder<E>(builder: &RsvgPathBuilder, emit_fn: &mut E)
             }
 
             Segment::LineOrCurve { .. } => {
-                /* Not a degenerate segment */
-
+                // Not a degenerate segment
                 match subpath_state {
                     SubpathState::NoSubpath => {
                         let (_, outgoing_vx, outgoing_vy) =
@@ -785,8 +761,7 @@ fn emit_markers_for_path_builder<E>(builder: &RsvgPathBuilder, emit_fn: &mut E)
         }
     }
 
-    /* Finally, render the last point */
-
+    // Finally, render the last point
     if !segments.is_empty() {
         let segment = &segments[segments.len() - 1];
         if let Segment::LineOrCurve { .. } = *segment {
@@ -813,8 +788,7 @@ fn emit_markers_for_path_builder<E>(builder: &RsvgPathBuilder, emit_fn: &mut E)
     }
 }
 
-/******************** Tests ******************* * * * * * * * * * * **/
-
+// ************************************  Tests ************************************
 #[cfg(test)]
 mod parser_tests {
     use super::*;
@@ -933,7 +907,7 @@ mod directionality_tests {
         assert_eq!(expected_segments, segments);
     }
 
-    /* Single open path; the easy case */
+    // Single open path; the easy case
 
     fn setup_open_path() -> RsvgPathBuilder {
         let mut builder = RsvgPathBuilder::new();
@@ -953,7 +927,7 @@ mod directionality_tests {
         test_path_builder_to_segments(&setup_open_path(), expected_segments);
     }
 
-    /* Multiple open subpaths */
+    // Multiple open subpaths
 
     fn setup_multiple_open_subpaths() -> RsvgPathBuilder {
         let mut builder = RsvgPathBuilder::new();
@@ -982,7 +956,7 @@ mod directionality_tests {
         test_path_builder_to_segments(&setup_multiple_open_subpaths(), expected_segments);
     }
 
-    /* Closed subpath; must have a line segment back to the first point */
+    // Closed subpath; must have a line segment back to the first point
 
     fn setup_closed_subpath() -> RsvgPathBuilder {
         let mut builder = RsvgPathBuilder::new();
@@ -1004,9 +978,9 @@ mod directionality_tests {
         test_path_builder_to_segments(&setup_closed_subpath(), expected_segments);
     }
 
-    /* Multiple closed subpaths; each must have a line segment back to their
-     * initial points, with no degenerate segments between subpaths.
-     */
+    // Multiple closed subpaths; each must have a line segment back to their
+    // initial points, with no degenerate segments between subpaths.
+    // 
 
     fn setup_multiple_closed_subpaths() -> RsvgPathBuilder {
         let mut builder = RsvgPathBuilder::new();
@@ -1039,9 +1013,9 @@ mod directionality_tests {
         test_path_builder_to_segments(&setup_multiple_closed_subpaths(), expected_segments);
     }
 
-    /* A lineto follows the first closed subpath, with no moveto to start the second subpath.
-     * The lineto must start at the first point of the first subpath.
-     */
+    // A lineto follows the first closed subpath, with no moveto to start the second subpath.
+    // The lineto must start at the first point of the first subpath.
+    // 
 
     fn setup_no_moveto_after_closepath() -> RsvgPathBuilder {
         let mut builder = RsvgPathBuilder::new();
@@ -1066,41 +1040,40 @@ mod directionality_tests {
         test_path_builder_to_segments(&setup_no_moveto_after_closepath(), expected_segments);
     }
 
-    /* Sequence of moveto; should generate degenerate points.
-     *
-     * This test is not enabled right now!  We create the
-     * path fixtures with Cairo, and Cairo compresses
-     * sequences of moveto into a single one.  So, we can't
-     * really test this, as we don't get the fixture we want.
-     *
-     * Eventually we'll probably have to switch librsvg to
-     * its own internal path representation which should
-     * allow for unelided path commands, and which should
-     * only build a cairo_path_t for the final rendering step.
-
-    fn setup_sequence_of_moveto () -> RsvgPathBuilder {
-        let mut builder = RsvgPathBuilder::new ();
-
-        builder.move_to (10.0, 10.0);
-        builder.move_to (20.0, 20.0);
-        builder.move_to (30.0, 30.0);
-        builder.move_to (40.0, 40.0);
-
-        builder
-    }
-
-    #[test]
-    fn path_to_segments_handles_sequence_of_moveto () {
-        let expected_segments: Vec<Segment> = vec! [
-            degenerate (10.0, 10.0),
-            degenerate (20.0, 20.0),
-            degenerate (30.0, 30.0),
-            degenerate (40.0, 40.0)
-        ];
-
-        test_path_builder_to_segments (&setup_sequence_of_moveto (), expected_segments);
-    }
-     */
+    // Sequence of moveto; should generate degenerate points.
+    // This test is not enabled right now!  We create the
+    // path fixtures with Cairo, and Cairo compresses
+    // sequences of moveto into a single one.  So, we can't
+    // really test this, as we don't get the fixture we want.
+    //
+    // Eventually we'll probably have to switch librsvg to
+    // its own internal path representation which should
+    // allow for unelided path commands, and which should
+    // only build a cairo_path_t for the final rendering step.
+    //
+    // fn setup_sequence_of_moveto () -> RsvgPathBuilder {
+    // let mut builder = RsvgPathBuilder::new ();
+    //
+    // builder.move_to (10.0, 10.0);
+    // builder.move_to (20.0, 20.0);
+    // builder.move_to (30.0, 30.0);
+    // builder.move_to (40.0, 40.0);
+    //
+    // builder
+    // }
+    //
+    // #[test]
+    // fn path_to_segments_handles_sequence_of_moveto () {
+    // let expected_segments: Vec<Segment> = vec! [
+    // degenerate (10.0, 10.0),
+    // degenerate (20.0, 20.0),
+    // degenerate (30.0, 30.0),
+    // degenerate (40.0, 40.0)
+    // ];
+    //
+    // test_path_builder_to_segments (&setup_sequence_of_moveto (), expected_segments);
+    // }
+    // 
 
     #[test]
     fn degenerate_segment_has_no_directionality() {
diff --git a/rsvg_internals/src/mask.rs b/rsvg_internals/src/mask.rs
index 2ea96ca0..af3a517d 100644
--- a/rsvg_internals/src/mask.rs
+++ b/rsvg_internals/src/mask.rs
@@ -50,18 +50,14 @@ 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)?),
 
diff --git a/rsvg_internals/src/node.rs b/rsvg_internals/src/node.rs
index 397ba301..f93e54ee 100644
--- a/rsvg_internals/src/node.rs
+++ b/rsvg_internals/src/node.rs
@@ -15,15 +15,13 @@ use parsers::ParseError;
 use property_bag::PropertyBag;
 use state::RsvgState;
 
-/* A *const RsvgNode is just a pointer for the C code's benefit: it
- * points to an  Rc<Node>, which is our refcounted Rust representation
- * of nodes.
- */
+// A *const RsvgNode is just a pointer for the C code's benefit: it
+// points to an  Rc<Node>, which is our refcounted Rust representation
+// of nodes.
 pub type RsvgNode = Rc<Node>;
 
-/* A *const RsvgCNodeImpl is just an opaque pointer to the C code's
- * struct for a particular node type.
- */
+// A *const RsvgCNodeImpl is just an opaque pointer to the C code's
+// struct for a particular node type.
 pub enum RsvgCNodeImpl {}
 
 pub trait NodeTrait: Downcast {
@@ -69,7 +67,7 @@ pub struct Node {
     node_impl: Box<NodeTrait>,
 }
 
-/* Keep this in sync with rsvg-private.h:RsvgNodeType */
+// Keep this in sync with rsvg-private.h:RsvgNodeType
 #[repr(C)]
 #[derive(Debug, Copy, Clone, PartialEq)]
 pub enum NodeType {
@@ -105,8 +103,8 @@ pub enum NodeType {
     TSpan,
     Use,
 
-    /* Filter primitives */
-    FilterPrimitiveFirst, /* just a marker; not a valid type */
+    // Filter primitives
+    FilterPrimitiveFirst, // just a marker; not a valid type
     FilterPrimitiveBlend,
     FilterPrimitiveColorMatrix,
     FilterPrimitiveComponentTransfer,
@@ -124,7 +122,7 @@ pub enum NodeType {
     FilterPrimitiveSpecularLighting,
     FilterPrimitiveTile,
     FilterPrimitiveTurbulence,
-    FilterPrimitiveLast, /* just a marker; not a valid type */
+    FilterPrimitiveLast, // just a marker; not a valid type
 }
 
 impl Node {
@@ -321,7 +319,6 @@ pub extern "C" fn rsvg_node_unref(raw_node: *mut RsvgNode) -> *mut RsvgNode {
 // See https://github.com/rust-lang/rust/issues/36497 - this is what
 // added Rc::ptr_eq(), but we don't want to depend on unstable Rust
 // just yet.
-
 fn rc_node_ptr_eq<T: ?Sized>(this: &Rc<T>, other: &Rc<T>) -> bool {
     let this_ptr: *const T = &**this;
     let other_ptr: *const T = &**other;
diff --git a/rsvg_internals/src/opacity.rs b/rsvg_internals/src/opacity.rs
index 9e1248ee..e4c3125a 100644
--- a/rsvg_internals/src/opacity.rs
+++ b/rsvg_internals/src/opacity.rs
@@ -36,20 +36,14 @@ 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::Inherit) => OpacitySpec { kind: OpacityKind::Inherit,
+                                                  opacity: 0, },
 
-            Ok(Opacity::Specified(val)) => {
-                OpacitySpec { kind: OpacityKind::Specified,
-                              opacity: opacity_to_u8(val), }
-            }
+            Ok(Opacity::Specified(val)) => OpacitySpec { kind: OpacityKind::Specified,
+                                                         opacity: opacity_to_u8(val), },
 
-            _ => {
-                OpacitySpec { kind: OpacityKind::ParseError,
-                              opacity: 0, }
-            }
+            _ => OpacitySpec { kind: OpacityKind::ParseError,
+                               opacity: 0, },
         }
     }
 }
diff --git a/rsvg_internals/src/paint_server.rs b/rsvg_internals/src/paint_server.rs
index 07d23d7d..c7afb6e7 100644
--- a/rsvg_internals/src/paint_server.rs
+++ b/rsvg_internals/src/paint_server.rs
@@ -29,11 +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'"))),
         }
     }
 }
diff --git a/rsvg_internals/src/path_builder.rs b/rsvg_internals/src/path_builder.rs
index 2b1de47e..f4ccfc24 100644
--- a/rsvg_internals/src/path_builder.rs
+++ b/rsvg_internals/src/path_builder.rs
@@ -81,14 +81,13 @@ impl RsvgPathBuilder {
         &self.path_commands
     }
 
-    /** * * * * * * * * * * **/
+    /// * * * * * * * * * * *
     // x1/y1: starting coordinates
     // rx/ry: radiuses before rotation
     // x_axis_rotation: Rotation angle for axes, in degrees
     // 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,
@@ -99,9 +98,8 @@ impl RsvgPathBuilder {
                sweep: Sweep,
                x2: f64,
                y2: f64) {
-        /* See Appendix F.6 Elliptical arc implementation notes
-        http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes */
-
+        // See Appendix F.6 Elliptical arc implementation notes
+        // http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes
         let f: f64;
         let sinf: f64;
         let cosf: f64;
@@ -129,7 +127,7 @@ impl RsvgPathBuilder {
 
         let is_large_arc = large_arc.0;
 
-        /* X-axis */
+        // X-axis
         f = x_axis_rotation * PI / 180.0;
         sinf = f.sin();
         cosf = f.cos();
@@ -137,8 +135,8 @@ impl RsvgPathBuilder {
         rx = rx.abs();
         ry = ry.abs();
 
-        /* Check the radius against floading point underflow.
-        See http://bugs.debian.org/508443 */
+        // Check the radius against floading point underflow.
+        // See http://bugs.debian.org/508443
         if (rx < f64::EPSILON) || (ry < f64::EPSILON) {
             self.line_to(x2, y2);
             return;
@@ -156,8 +154,7 @@ impl RsvgPathBuilder {
             ry *= gamma.sqrt();
         }
 
-        /* Compute the center */
-
+        // Compute the center
         k1 = rx * rx * y1_ * y1_ + ry * ry * x1_ * x1_;
         if k1 == 0.0 {
             return;
@@ -174,8 +171,7 @@ impl RsvgPathBuilder {
         cx = cosf * cx_ - sinf * cy_ + (x1 + x2) / 2.0;
         cy = sinf * cx_ + cosf * cy_ + (y1 + y2) / 2.0;
 
-        /* Compute start angle */
-
+        // Compute start angle
         k1 = (x1_ - cx_) / rx;
         k2 = (y1_ - cy_) / ry;
         k3 = (-x1_ - cx_) / rx;
@@ -193,8 +189,7 @@ impl RsvgPathBuilder {
             theta1 = -theta1;
         }
 
-        /* Compute delta_theta */
-
+        // Compute delta_theta
         k5 = ((k1 * k1 + k2 * k2) * (k3 * k3 + k4 * k4)).abs().sqrt();
         if k5 == 0.0 {
             return;
@@ -213,8 +208,7 @@ impl RsvgPathBuilder {
             delta_theta -= PI * 2.0;
         }
 
-        /* Now draw the arc */
-
+        // Now draw the arc
         n_segs = (delta_theta / (PI * 0.5 + 0.001)).abs().ceil() as i32;
         let n_segs_dbl = f64::from(n_segs);
 
diff --git a/rsvg_internals/src/path_parser.rs b/rsvg_internals/src/path_parser.rs
index 08eadc2a..e87fa2e8 100644
--- a/rsvg_internals/src/path_parser.rs
+++ b/rsvg_internals/src/path_parser.rs
@@ -7,37 +7,33 @@ use std::str::Chars;
 
 struct PathParser<'b> {
     chars_enumerator: Enumerate<Chars<'b>>,
-    lookahead: Option<char>,    /* None if we are in EOF */
-    current_pos: Option<usize>, /* None if the string hasn't been scanned */
+    lookahead: Option<char>,    // None if we are in EOF
+    current_pos: Option<usize>, // None if the string hasn't been scanned
 
     builder: &'b mut RsvgPathBuilder,
 
-    /* Current point; adjusted at every command */
+    // Current point; adjusted at every command
     current_x: f64,
     current_y: f64,
 
-    /* Last control point from previous cubic curve command, used to reflect
-     * the new control point for smooth cubic curve commands.
-     */
+    // Last control point from previous cubic curve command, used to reflect
+    // the new control point for smooth cubic curve commands.
     cubic_reflection_x: f64,
     cubic_reflection_y: f64,
 
-    /* Last control point from previous quadratic curve command, used to reflect
-     * the new control point for smooth quadratic curve commands.
-     */
+    // Last control point from previous quadratic curve command, used to reflect
+    // the new control point for smooth quadratic curve commands.
     quadratic_reflection_x: f64,
     quadratic_reflection_y: f64,
 
-    /* Start point of current subpath (i.e. position of last moveto);
-     * used for closepath.
-     */
+    // Start point of current subpath (i.e. position of last moveto);
+    // used for closepath.
     subpath_start_x: f64,
     subpath_start_y: f64,
 }
 
-/* This is a recursive descent parser for path data in SVG files,
- * as specified in https://www.w3.org/TR/SVG/paths.html#PathDataBNF */
-//
+// This is a recursive descent parser for path data in SVG files,
+// as specified in https://www.w3.org/TR/SVG/paths.html#PathDataBNF
 // Some peculiarities:
 //
 // - SVG allows optional commas inside coordiante pairs, and between
@@ -59,7 +55,6 @@ struct PathParser<'b> {
 //
 //     M.1-2,3E2-4
 //     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(),
@@ -202,16 +197,14 @@ impl<'b> PathParser<'b> {
         let mut c: char = ' ';
 
         if self.lookahead_is_digit(&mut c) || self.lookahead_is('.') {
-            /* Integer part */
-
+            // Integer part
             while self.lookahead_is_digit(&mut c) {
                 value = value * 10.0 + f64::from(char_to_digit(c));
 
                 assert!(self.match_char(c));
             }
 
-            /* Fractional part */
-
+            // Fractional part
             if self.match_char('.') {
                 let mut fraction: f64 = 1.0;
 
@@ -226,16 +219,14 @@ impl<'b> PathParser<'b> {
             }
 
             if self.match_char('E') || self.match_char('e') {
-                /* exponent sign */
-
+                // exponent sign
                 if self.match_char('+') {
                     exponent_sign = 1.0;
                 } else if self.match_char('-') {
                     exponent_sign = -1.0;
                 }
 
-                /* exponent */
-
+                // exponent
                 let mut c: char = ' ';
 
                 if self.lookahead_is_digit(&mut c) {
@@ -342,8 +333,7 @@ impl<'b> PathParser<'b> {
     }
 
     fn emit_quadratic_curve_to(&mut self, a: f64, b: f64, c: f64, d: f64) {
-        /* raise quadratic Bézier to cubic */
-
+        // raise quadratic Bézier to cubic
         let x2 = (self.current_x + 2.0 * a) / 3.0;
         let y2 = (self.current_y + 2.0 * b) / 3.0;
         let x4 = c;
@@ -1368,12 +1358,10 @@ mod tests {
                     None);
     }
 
-    /* FIXME: we don't have a handles_arc() because
-     * we don't know what segments will be computed by PathBuilder::arc().
-     * Maybe we need to represent arcs as native path builder segments,
-     * and only explode them to Cairo curves at rendering time.
-     */
-
+    // FIXME: we don't have a handles_arc() because
+    // we don't know what segments will be computed by PathBuilder::arc().
+    // Maybe we need to represent arcs as native path builder segments,
+    // and only explode them to Cairo curves at rendering time.
     #[test]
     fn first_command_must_be_moveto() {
         test_parser("  L10 20", "  ^", &vec![], Some(ErrorKind::UnexpectedToken));
@@ -1713,11 +1701,11 @@ mod tests {
                     &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().
-         * Maybe we need to represent arcs as native path builder segments,
-         * and only explode them to Cairo curves at rendering time.
-         */
+        // FIXME: we don't test the arc results, because
+        // we don't know what segments will be computed by PathBuilder::arc().
+        // Maybe we need to represent arcs as native path builder segments,
+        // and only explode them to Cairo curves at rendering time.
+        //
         // test_parser("M10-20A1 2 3,1,1,6,7,",
         //             "                     ^",
         //             &vec![moveto(10.0, -20.0)
diff --git a/rsvg_internals/src/shapes.rs b/rsvg_internals/src/shapes.rs
index 5ebcd90c..8543e2e4 100644
--- a/rsvg_internals/src/shapes.rs
+++ b/rsvg_internals/src/shapes.rs
@@ -38,7 +38,6 @@ fn render_ellipse(cx: f64,
                   draw_ctx: *const RsvgDrawingCtx,
                   dominate: i32) {
     // Per the spec, rx and ry must be nonnegative
-
     if rx <= 0.0 || ry <= 0.0 {
         return;
     }
@@ -47,7 +46,6 @@ fn render_ellipse(cx: f64,
     let arc_magic: f64 = 0.5522847498;
 
     // approximate an ellipse using 4 Bézier curves
-
     let mut builder = RsvgPathBuilder::new();
 
     builder.move_to(cx + rx, cy);
@@ -85,8 +83,7 @@ fn render_ellipse(cx: f64,
     render_path_builder(&builder, draw_ctx, node.get_state(), dominate, false);
 }
 
-/***** NodePath **** * * * * * * * * * * **/
-
+// ************ NodePath ************
 struct NodePath {
     builder: RefCell<Option<RsvgPathBuilder>>,
 }
@@ -126,8 +123,7 @@ impl NodeTrait for NodePath {
     }
 }
 
-/***** NodePoly **** * * * * * * * * * * **/
-
+// ************ NodePoly ************
 #[derive(Debug, PartialEq)]
 enum PolyKind {
     Open,
@@ -150,7 +146,6 @@ impl NodeTrait for NodePoly {
     fn set_atts(&self, _: &RsvgNode, _: *const RsvgHandle, pbag: &PropertyBag) -> NodeResult {
         for (key, attr, value) in pbag.iter() {
             // support for svg < 1.0 which used verts
-
             if attr == Attribute::Points || attr == Attribute::Verts {
                 let result = parsers::list_of_points(value.trim());
 
@@ -195,8 +190,7 @@ impl NodeTrait for NodePoly {
     }
 }
 
-/***** NodeLine **** * * * * * * * * * * **/
-
+// ************ NodeLine ************
 struct NodeLine {
     x1: Cell<RsvgLength>,
     y1: Cell<RsvgLength>,
@@ -247,8 +241,7 @@ impl NodeTrait for NodeLine {
     }
 }
 
-/***** NodeRect **** * * * * * * * * * * **/
-
+// ************ NodeRect ************
 struct NodeRect {
     // x, y, width, height
     x: Cell<RsvgLength>,
@@ -360,8 +353,7 @@ impl NodeTrait for NodeRect {
         let mut builder = RsvgPathBuilder::new();
 
         if rx == 0.0 {
-            /* Easy case, no rounded corners */
-
+            // Easy case, no rounded corners
             builder.move_to(x, y);
             builder.line_to(x + w, y);
             builder.line_to(x + w, y + h);
@@ -442,8 +434,7 @@ impl NodeTrait for NodeRect {
     }
 }
 
-/***** NodeCircle **** * * * * * * * * * * **/
-
+// ************ NodeCircle ************
 struct NodeCircle {
     cx: Cell<RsvgLength>,
     cy: Cell<RsvgLength>,
@@ -464,12 +455,10 @@ impl NodeTrait for NodeCircle {
             match attr {
                 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))?),
 
                 _ => (),
             }
@@ -491,8 +480,7 @@ impl NodeTrait for NodeCircle {
     }
 }
 
-/***** NodeEllipse **** * * * * * * * * * * **/
-
+// ************ NodeEllipse ************
 struct NodeEllipse {
     cx: Cell<RsvgLength>,
     cy: Cell<RsvgLength>,
@@ -516,18 +504,14 @@ impl NodeTrait for NodeEllipse {
                 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))?),
 
                 _ => (),
             }
@@ -550,8 +534,7 @@ impl NodeTrait for NodeEllipse {
     }
 }
 
-/***** C Prototypes **** * * * * * * * * * * **/
-
+// ************ C Prototypes ************
 #[no_mangle]
 pub extern "C" fn rsvg_node_path_new(_: *const libc::c_char,
                                      raw_parent: *const RsvgNode)
diff --git a/rsvg_internals/src/structure.rs b/rsvg_internals/src/structure.rs
index 0260eeb4..20897848 100644
--- a/rsvg_internals/src/structure.rs
+++ b/rsvg_internals/src/structure.rs
@@ -19,8 +19,7 @@ use util::*;
 use viewbox::*;
 use viewport::{draw_in_viewport, ClipMode};
 
-/***** NodeGroup **** * * * * * * * * * * **/
-
+// ************ NodeGroup ************
 struct NodeGroup();
 
 impl NodeGroup {
@@ -43,8 +42,7 @@ impl NodeTrait for NodeGroup {
     }
 }
 
-/***** NodeDefs **** * * * * * * * * * * **/
-
+// ************ NodeDefs ************
 struct NodeDefs();
 
 impl NodeDefs {
@@ -67,8 +65,7 @@ impl NodeTrait for NodeDefs {
     }
 }
 
-/***** NodeSwitch **** * * * * * * * * * * **/
-
+// ************ NodeSwitch ************
 struct NodeSwitch();
 
 impl NodeSwitch {
@@ -109,8 +106,7 @@ impl NodeTrait for NodeSwitch {
     }
 }
 
-/***** NodeSvg **** * * * * * * * * * * **/
-
+// ************ NodeSvg ************
 struct NodeSvg {
     preserve_aspect_ratio: Cell<AspectRatio>,
     x: Cell<RsvgLength>,
@@ -157,19 +153,15 @@ 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)?),
 
@@ -217,8 +209,7 @@ impl NodeTrait for NodeSvg {
     }
 }
 
-/***** NodeUse **** * * * * * * * * * * **/
-
+// ************ NodeUse ************
 struct NodeUse {
     link: RefCell<Option<String>>,
     x: Cell<RsvgLength>,
@@ -351,8 +342,7 @@ impl NodeTrait for NodeUse {
     }
 }
 
-/***** NodeSymbol **** * * * * * * * * * * **/
-
+// ************ NodeSymbol ************
 struct NodeSymbol {
     preserve_aspect_ratio: Cell<AspectRatio>,
     vbox: Cell<Option<ViewBox>>,
@@ -391,8 +381,7 @@ impl NodeTrait for NodeSymbol {
     }
 }
 
-/***** C Prototypes **** * * * * * * * * * * **/
-
+// ************ C Prototypes ************
 #[no_mangle]
 pub extern "C" fn rsvg_node_group_new(_: *const libc::c_char,
                                       raw_parent: *const RsvgNode)
diff --git a/rsvg_internals/src/viewbox.rs b/rsvg_internals/src/viewbox.rs
index 97a03df7..8d01d64f 100644
--- a/rsvg_internals/src/viewbox.rs
+++ b/rsvg_internals/src/viewbox.rs
@@ -9,7 +9,7 @@ use parsers::Parse;
 
 use self::glib::translate::*;
 
-/* Keep this in sync with rsvg-private.h:RsvgViewBox */
+// Keep this in sync with rsvg-private.h:RsvgViewBox
 #[repr(C)]
 #[derive(Debug, Copy, Clone, PartialEq)]
 pub struct RsvgViewBox {


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