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()));