[librsvg/librsvg-2.44] rustfmt
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.44] rustfmt
- Date: Tue, 9 Oct 2018 14:18:08 +0000 (UTC)
commit 15a0151905c5caad66711018574557aac17273e5
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Oct 1 14:28:52 2018 -0500
rustfmt
rsvg_internals/build.rs | 6 +++--
rsvg_internals/src/aspect_ratio.rs | 3 ++-
rsvg_internals/src/coord_units.rs | 3 ++-
rsvg_internals/src/drawing_ctx.rs | 18 ++++++++++-----
rsvg_internals/src/filters/composite.rs | 3 ++-
rsvg_internals/src/filters/context.rs | 9 +++++---
rsvg_internals/src/filters/image.rs | 3 ++-
rsvg_internals/src/filters/mod.rs | 9 +++++---
rsvg_internals/src/filters/turbulence.rs | 6 +++--
rsvg_internals/src/gradient.rs | 9 +++++---
rsvg_internals/src/marker.rs | 12 ++++++----
rsvg_internals/src/shapes.rs | 3 ++-
rsvg_internals/src/space.rs | 9 +++++---
rsvg_internals/src/structure.rs | 6 +++--
rsvg_internals/src/surface_utils/iterators.rs | 6 +++--
rsvg_internals/src/surface_utils/shared_surface.rs | 6 +++--
rsvg_internals/src/text.rs | 3 ++-
rsvg_internals/src/transform.rs | 27 ++++++++++++++--------
18 files changed, 94 insertions(+), 47 deletions(-)
---
diff --git a/rsvg_internals/build.rs b/rsvg_internals/build.rs
index c6cfc78c..45032bda 100644
--- a/rsvg_internals/build.rs
+++ b/rsvg_internals/build.rs
@@ -172,7 +172,8 @@ fn generate_phf_of_svg_attributes() {
writeln!(
&mut file,
"#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]"
- ).unwrap();
+ )
+ .unwrap();
writeln!(&mut file, "pub enum Attribute {{").unwrap();
for &(_, valname) in attribute_defs.iter() {
@@ -184,7 +185,8 @@ fn generate_phf_of_svg_attributes() {
writeln!(
&mut file,
"static ATTRIBUTES: phf::Map<&'static str, Attribute> = "
- ).unwrap();
+ )
+ .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 b02c2785..baad541f 100644
--- a/rsvg_internals/src/aspect_ratio.rs
+++ b/rsvg_internals/src/aspect_ratio.rs
@@ -200,7 +200,8 @@ impl Parse for AspectRatio {
p.expect_ident()
.map_err(|_| ValueErrorKind::Parse(ParseError::new("expected identifier")))
.and_then(|ident| parse_fit_mode(ident))
- }).unwrap_or(FitMode::default());
+ })
+ .unwrap_or(FitMode::default());
parser
.expect_exhausted()
diff --git a/rsvg_internals/src/coord_units.rs b/rsvg_internals/src/coord_units.rs
index 2e4ed8ea..30513cfa 100644
--- a/rsvg_internals/src/coord_units.rs
+++ b/rsvg_internals/src/coord_units.rs
@@ -32,7 +32,8 @@ impl Parse for CoordUnits {
cow.as_ref().to_string(),
))),
),
- }).map_err(|_| {
+ })
+ .map_err(|_| {
ValueErrorKind::Parse(ParseError::new(
"expected 'userSpaceOnUse' or 'objectBoundingBox'",
))
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index b5a98300..e372caca 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -152,7 +152,8 @@ impl<'a> DrawingCtx<'a> {
y: 0.0,
width,
height,
- }.transform(&affine)
+ }
+ .transform(&affine)
.outer();
// scale according to size set by size_func callback
@@ -597,7 +598,8 @@ impl<'a> DrawingCtx<'a> {
fill_opacity,
&bbox,
current_color,
- ).and_then(|had_paint_server| {
+ )
+ .and_then(|had_paint_server| {
if had_paint_server {
pangocairo::functions::update_layout(&cr, layout);
pangocairo::functions::show_layout(&cr, layout);
@@ -620,7 +622,8 @@ impl<'a> DrawingCtx<'a> {
stroke_opacity,
&bbox,
¤t_color,
- ).and_then(|had_paint_server| {
+ )
+ .and_then(|had_paint_server| {
if had_paint_server {
need_layout_path = true;
}
@@ -700,7 +703,8 @@ impl<'a> DrawingCtx<'a> {
fill_opacity,
&bbox,
current_color,
- ).and_then(|had_paint_server| {
+ )
+ .and_then(|had_paint_server| {
if had_paint_server {
if values.stroke.0 == PaintServer::None {
cr.fill();
@@ -710,7 +714,8 @@ impl<'a> DrawingCtx<'a> {
}
Ok(())
- }).and_then(|_| {
+ })
+ .and_then(|_| {
let stroke_opacity = values.stroke_opacity.0;
paint_server::set_source_paint_server(
@@ -719,7 +724,8 @@ impl<'a> DrawingCtx<'a> {
&stroke_opacity,
&bbox,
¤t_color,
- ).and_then(|had_paint_server| {
+ )
+ .and_then(|had_paint_server| {
if had_paint_server {
cr.stroke();
}
diff --git a/rsvg_internals/src/filters/composite.rs b/rsvg_internals/src/filters/composite.rs
index c95e4edf..378d4732 100644
--- a/rsvg_internals/src/filters/composite.rs
+++ b/rsvg_internals/src/filters/composite.rs
@@ -256,7 +256,8 @@ impl Parse for Operator {
cow.as_ref().to_string(),
))),
),
- }).map_err(|_| ValueErrorKind::Value("invalid operator value".to_string()))
+ })
+ .map_err(|_| ValueErrorKind::Value("invalid operator value".to_string()))
}
}
diff --git a/rsvg_internals/src/filters/context.rs b/rsvg_internals/src/filters/context.rs
index 5b7ac446..62d07930 100644
--- a/rsvg_internals/src/filters/context.rs
+++ b/rsvg_internals/src/filters/context.rs
@@ -472,7 +472,8 @@ impl FilterContext {
&opacity,
&bbox,
&self.computed_from_node_being_filtered.color.0,
- ).and_then(|had_paint_server| {
+ )
+ .and_then(|had_paint_server| {
if had_paint_server {
cr.paint();
}
@@ -523,14 +524,16 @@ impl FilterContext {
.and_then(|surface| {
SharedImageSurface::new(surface, SurfaceType::SRgb)
.map_err(FilterError::CairoError)
- }).map(FilterInput::StandardInput),
+ })
+ .map(FilterInput::StandardInput),
Input::StrokePaint => self
.get_paint_server_surface(draw_ctx, &values.stroke.0, values.stroke_opacity.0)
.map_err(FilterError::CairoError)
.and_then(|surface| {
SharedImageSurface::new(surface, SurfaceType::SRgb)
.map_err(FilterError::CairoError)
- }).map(FilterInput::StandardInput),
+ })
+ .map(FilterInput::StandardInput),
Input::FilterOutput(ref name) => self
.filter_output(name)
diff --git a/rsvg_internals/src/filters/image.rs b/rsvg_internals/src/filters/image.rs
index 4420bdc3..0a1ab35c 100644
--- a/rsvg_internals/src/filters/image.rs
+++ b/rsvg_internals/src/filters/image.rs
@@ -75,7 +75,8 @@ impl Image {
&surface,
f64::from(ctx.source_graphic().width()),
f64::from(ctx.source_graphic().height()),
- ).map_err(|e| {
+ )
+ .map_err(|e| {
if let RenderingError::Cairo(status) = e {
FilterError::CairoError(status)
} else {
diff --git a/rsvg_internals/src/filters/mod.rs b/rsvg_internals/src/filters/mod.rs
index a2a3ec11..91460eac 100644
--- a/rsvg_internals/src/filters/mod.rs
+++ b/rsvg_internals/src/filters/mod.rs
@@ -126,7 +126,8 @@ impl NodeTrait for Primitive {
} else {
None
}
- }).unwrap_or(CoordUnits::UserSpaceOnUse);
+ })
+ .unwrap_or(CoordUnits::UserSpaceOnUse);
let no_units_allowed = primitiveunits == CoordUnits::ObjectBoundingBox;
let check_units = |length: Length| {
@@ -292,7 +293,8 @@ pub fn render(
};
(c, linear_rgb)
- }).filter_map(|(c, linear_rgb)| {
+ })
+ .filter_map(|(c, linear_rgb)| {
let rr = RcRef::new(c)
.try_map(|c| {
// Go through the filter primitives and see if the node is one of them.
@@ -333,7 +335,8 @@ pub fn render(
turbulence::Turbulence,
);
filter.ok_or(())
- }).ok();
+ })
+ .ok();
rr.map(|rr| (rr, linear_rgb))
});
diff --git a/rsvg_internals/src/filters/turbulence.rs b/rsvg_internals/src/filters/turbulence.rs
index 1425ed54..30643d59 100644
--- a/rsvg_internals/src/filters/turbulence.rs
+++ b/rsvg_internals/src/filters/turbulence.rs
@@ -94,7 +94,8 @@ impl NodeTrait for Turbulence {
f64::from(i32::min_value()),
f64::from(i32::max_value()),
) as i32
- }).map_err(|err| NodeError::attribute_error(attr, err))?,
+ })
+ .map_err(|err| NodeError::attribute_error(attr, err))?,
),
Attribute::StitchTiles => self.stitch_tiles.set(StitchTiles::parse(attr, value)?),
Attribute::Type => self.type_.set(NoiseType::parse(attr, value)?),
@@ -398,7 +399,8 @@ impl Filter for Turbulence {
g: generate(1),
b: generate(2),
a: generate(3),
- }.premultiply();
+ }
+ .premultiply();
output_data.set_pixel(output_stride, pixel, x as u32, y as u32);
}
diff --git a/rsvg_internals/src/gradient.rs b/rsvg_internals/src/gradient.rs
index bf7bf9f4..abc24ca2 100644
--- a/rsvg_internals/src/gradient.rs
+++ b/rsvg_internals/src/gradient.rs
@@ -53,7 +53,8 @@ impl Parse for SpreadMethod {
cow.as_ref().to_string(),
))),
),
- }).map_err(|_| {
+ })
+ .map_err(|_| {
ValueErrorKind::Parse(ParseError::new("expected 'pad' | 'reflect' | 'repeat'"))
})
}
@@ -379,7 +380,8 @@ impl Gradient {
}
!in_error
- }).for_each(|child| {
+ })
+ .for_each(|child| {
child.with_impl(|stop: &NodeStop| {
let cascaded = child.get_cascaded_values();
let values = cascaded.get();
@@ -444,7 +446,8 @@ fn resolve_gradient(gradient: &Gradient, draw_ctx: &mut DrawingCtx<'_>) -> Gradi
result.resolve_from_fallback(&fallback_grad)
});
Some(())
- }).or_else(|| {
+ })
+ .or_else(|| {
result.resolve_from_defaults();
Some(())
});
diff --git a/rsvg_internals/src/marker.rs b/rsvg_internals/src/marker.rs
index 40adc887..d9f80c01 100644
--- a/rsvg_internals/src/marker.rs
+++ b/rsvg_internals/src/marker.rs
@@ -51,7 +51,8 @@ impl Parse for MarkerUnits {
cow.as_ref().to_string(),
))),
),
- }).map_err(|_| {
+ })
+ .map_err(|_| {
ValueErrorKind::Parse(ParseError::new(
"expected \"userSpaceOnUse\" or \"strokeWidth\"",
))
@@ -1261,7 +1262,8 @@ mod directionality_tests {
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();
+ ))
+ .unwrap();
assert_eq!((40.0, 30.0), (v1x, v1y));
assert_eq!((40.0, 30.0), (v2x, v2y));
@@ -1293,7 +1295,8 @@ mod marker_tests {
v.push((marker_type, x, y, computed_angle));
Ok(())
}
- ).is_ok()
+ )
+ .is_ok()
);
assert_eq!(
@@ -1329,7 +1332,8 @@ mod marker_tests {
v.push((marker_type, x, y, computed_angle));
Ok(())
}
- ).is_ok()
+ )
+ .is_ok()
);
assert_eq!(
diff --git a/rsvg_internals/src/shapes.rs b/rsvg_internals/src/shapes.rs
index 03a626c1..6cf395a3 100644
--- a/rsvg_internals/src/shapes.rs
+++ b/rsvg_internals/src/shapes.rs
@@ -347,7 +347,8 @@ impl NodeTrait for NodeRect {
value,
LengthDir::Horizontal,
Length::check_nonnegative,
- ).map(Some)?,
+ )
+ .map(Some)?,
),
Attribute::Ry => self.ry.set(
parse_and_validate("ry", value, LengthDir::Vertical, Length::check_nonnegative)
diff --git a/rsvg_internals/src/space.rs b/rsvg_internals/src/space.rs
index d61afaad..20ffb326 100644
--- a/rsvg_internals/src/space.rs
+++ b/rsvg_internals/src/space.rs
@@ -28,10 +28,12 @@ fn normalize_default(s: &str) -> String {
.map(|ch| match ch {
'\t' => ' ',
c => c,
- }).coalesce(|current, next| match (current, next) {
+ })
+ .coalesce(|current, next| match (current, next) {
(' ', ' ') => Ok(' '),
(_, _) => Err((current, next)),
- }).collect::<String>()
+ })
+ .collect::<String>()
}
// From https://www.w3.org/TR/SVG/text.html#WhiteSpace
@@ -50,7 +52,8 @@ fn normalize_preserve(s: &str) -> String {
'\n' | '\t' => ' ',
c => c,
- }).collect()
+ })
+ .collect()
}
#[cfg(test)]
diff --git a/rsvg_internals/src/structure.rs b/rsvg_internals/src/structure.rs
index 90e435ed..1965f176 100644
--- a/rsvg_internals/src/structure.rs
+++ b/rsvg_internals/src/structure.rs
@@ -260,7 +260,8 @@ impl NodeTrait for NodeUse {
value,
LengthDir::Horizontal,
Length::check_nonnegative,
- ).map(Some)?,
+ )
+ .map(Some)?,
),
Attribute::Height => self.h.set(
parse_and_validate(
@@ -268,7 +269,8 @@ impl NodeTrait for NodeUse {
value,
LengthDir::Vertical,
Length::check_nonnegative,
- ).map(Some)?,
+ )
+ .map(Some)?,
),
_ => (),
diff --git a/rsvg_internals/src/surface_utils/iterators.rs b/rsvg_internals/src/surface_utils/iterators.rs
index 477006ca..096f01c2 100644
--- a/rsvg_internals/src/surface_utils/iterators.rs
+++ b/rsvg_internals/src/surface_utils/iterators.rs
@@ -196,7 +196,8 @@ mod tests {
let surface = SharedImageSurface::new(
ImageSurface::create(cairo::Format::ARgb32, WIDTH, HEIGHT).unwrap(),
SurfaceType::SRgb,
- ).unwrap();
+ )
+ .unwrap();
// Full image.
let bounds = IRect {
@@ -273,7 +274,8 @@ mod tests {
let surface = SharedImageSurface::new(
ImageSurface::create(cairo::Format::ARgb32, WIDTH, HEIGHT).unwrap(),
SurfaceType::SRgb,
- ).unwrap();
+ )
+ .unwrap();
let bounds = IRect {
x0: 0,
diff --git a/rsvg_internals/src/surface_utils/shared_surface.rs
b/rsvg_internals/src/surface_utils/shared_surface.rs
index 36852c09..db86cfe5 100644
--- a/rsvg_internals/src/surface_utils/shared_surface.rs
+++ b/rsvg_internals/src/surface_utils/shared_surface.rs
@@ -642,7 +642,8 @@ impl SharedImageSurface {
stride: self.stride,
ptr: NonNull::new(unsafe {
self.ptr.as_ptr().offset(index as isize * self.stride)
- }).unwrap(),
+ })
+ .unwrap(),
_marker: PhantomData,
},
)
@@ -670,7 +671,8 @@ impl SharedImageSurface {
stride: self.stride,
ptr: NonNull::new(unsafe {
self.ptr.as_ptr().offset(index as isize * 4)
- }).unwrap(),
+ })
+ .unwrap(),
_marker: PhantomData,
},
)
diff --git a/rsvg_internals/src/text.rs b/rsvg_internals/src/text.rs
index 3fa42ec3..c3d05f97 100644
--- a/rsvg_internals/src/text.rs
+++ b/rsvg_internals/src/text.rs
@@ -541,7 +541,8 @@ fn create_pango_layout(
attr_list.insert(
pango::Attribute::new_letter_spacing(to_pango_units(
values.letter_spacing.0.normalize(values, ¶ms),
- )).unwrap(),
+ ))
+ .unwrap(),
);
if values.text_decoration.underline {
diff --git a/rsvg_internals/src/transform.rs b/rsvg_internals/src/transform.rs
index 886dd967..0ddbd60d 100644
--- a/rsvg_internals/src/transform.rs
+++ b/rsvg_internals/src/transform.rs
@@ -98,7 +98,8 @@ fn parse_matrix_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, Value
let y0 = p.expect_number()?;
Ok((xx, yx, xy, yy, x0, y0))
- }).map_err(CssParseError::<()>::basic)
+ })
+ .map_err(CssParseError::<()>::basic)
.map_err(|e| ValueErrorKind::from(e))
.and_then(|(xx, yx, xy, yy, x0, y0)| {
let xx = f64::from(finite_f32(xx)?);
@@ -121,10 +122,12 @@ fn parse_translate_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, Va
.try(|p| -> Result<f32, CssParseError<'_, ()>> {
optional_comma(p);
Ok(p.expect_number()?)
- }).unwrap_or(0.0);
+ })
+ .unwrap_or(0.0);
Ok((tx, ty))
- }).map_err(CssParseError::<()>::basic)
+ })
+ .map_err(CssParseError::<()>::basic)
.map_err(|e| ValueErrorKind::from(e))
.and_then(|(tx, ty)| {
let tx = f64::from(finite_f32(tx)?);
@@ -143,10 +146,12 @@ fn parse_scale_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, ValueE
.try(|p| -> Result<f32, CssParseError<'_, ()>> {
optional_comma(p);
Ok(p.expect_number()?)
- }).unwrap_or(x);
+ })
+ .unwrap_or(x);
Ok((x, y))
- }).map_err(CssParseError::<()>::basic)
+ })
+ .map_err(CssParseError::<()>::basic)
.map_err(|e| ValueErrorKind::from(e))
.and_then(|(x, y)| {
let x = f64::from(finite_f32(x)?);
@@ -170,10 +175,12 @@ fn parse_rotate_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, Value
let ty = p.expect_number()?;
Ok((tx, ty))
- }).unwrap_or((0.0, 0.0));
+ })
+ .unwrap_or((0.0, 0.0));
Ok((angle, tx, ty))
- }).map_err(CssParseError::<()>::basic)
+ })
+ .map_err(CssParseError::<()>::basic)
.map_err(|e| ValueErrorKind::from(e))
.and_then(|(angle, tx, ty)| {
let angle = f64::from(finite_f32(angle)?);
@@ -196,7 +203,8 @@ fn parse_skewx_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, ValueE
.parse_nested_block(|p| {
let a = p.expect_number()?;
Ok(a)
- }).map_err(CssParseError::<()>::basic)
+ })
+ .map_err(CssParseError::<()>::basic)
.map_err(|e| ValueErrorKind::from(e))
.and_then(|a| {
let a = f64::from(finite_f32(a)?);
@@ -211,7 +219,8 @@ fn parse_skewy_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, ValueE
.parse_nested_block(|p| {
let a = p.expect_number()?;
Ok(a)
- }).map_err(CssParseError::<()>::basic)
+ })
+ .map_err(CssParseError::<()>::basic)
.map_err(|e| ValueErrorKind::from(e))
.and_then(|a| {
let a = f64::from(finite_f32(a)?);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]