diff --git a/src/geometry.rs b/src/geometry.rs index 3afe576..5c645da 100644 --- a/src/geometry.rs +++ b/src/geometry.rs @@ -92,19 +92,11 @@ impl Rectangle { let width = (corner_a.x() as i64 - corner_b.x() as i64).abs() as u32; let height = (corner_a.y() as i64 - corner_b.y() as i64).abs() as u32; - Rectangle { - top_left: Point::new(left, top), - width, - height, - } + Rectangle::from_corner_width_height(Point::new(left, top), width, height) } fn at_origin_with_size(width: u32, height: u32) -> Rectangle { - Rectangle { - top_left: Point::origin(), - width, - height, - } + Rectangle::from_corner_width_height(Point::origin(), width, height) } fn width(&self) -> u32 {