Call one Rectangle constructor from the others
This commit is contained in:
parent
5e028c20ae
commit
4d73035a4e
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue