From 5ff1afc26b69c1962e9ce266e7908628861f58b2 Mon Sep 17 00:00:00 2001 From: arnekeller Date: Sat, 6 Apr 2019 18:18:03 +0200 Subject: [PATCH] Formatting --- src/input.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/input.rs b/src/input.rs index 91f697a..695430a 100644 --- a/src/input.rs +++ b/src/input.rs @@ -40,12 +40,7 @@ fn read_stdin() -> InputData { let corner_count = numbers[0]; polygons.push(Polygon::new( (0..corner_count) - .map(|idx| { - ( - numbers[idx * 2 + 1] as f32, - numbers[idx * 2 + 2] as f32, - ) - }) + .map(|idx| (numbers[idx * 2 + 1] as f32, numbers[idx * 2 + 2] as f32)) .collect::>() .into(), vec![], @@ -71,7 +66,7 @@ fn read_svg(input: &str) -> Result> { let svg = svg.svg_element().unwrap(); let svg_height = match svg.attributes().get_value(AttributeId::Height).unwrap() { AttributeValue::Length(l) => l.num as f32, - _ => -42.0 + _ => -42.0, }; let mut house = None; let mut polys = Vec::new(); @@ -89,13 +84,16 @@ fn read_svg(input: &str) -> Result> { for p in &path.0 { match p { PathSegment::MoveTo { x, y, .. } => { - points.push(Point::new(*x as f32, svg_height-*y as f32)); + points.push(Point::new(*x as f32, svg_height - *y as f32)); } PathSegment::LineTo { x, y, .. } => { - points.push(Point::new(*x as f32, svg_height-*y as f32)); + points.push(Point::new(*x as f32, svg_height - *y as f32)); } PathSegment::VerticalLineTo { y, .. } => { - points.push(Point::new(points.last().unwrap().x(), svg_height-*y as f32)); + points.push(Point::new( + points.last().unwrap().x(), + svg_height - *y as f32, + )); } PathSegment::HorizontalLineTo { x, .. } => { points.push(Point::new(*x as f32, points.last().unwrap().y()));