diff options
author | kingdido999 <kingdido999@gmail.com> | 2018-09-04 09:51:55 +0800 |
---|---|---|
committer | kingdido999 <kingdido999@gmail.com> | 2018-09-04 09:51:55 +0800 |
commit | ec9d0f21a6561f379fcc42bff766356b6207ecd0 (patch) | |
tree | 9769a42d64538dc197a7e8fb9da105ba57af34d4 /components/geometry/lib.rs | |
parent | 156b1cc8918a2923f41582fb65f4eb661f84de0c (diff) | |
download | servo-ec9d0f21a6561f379fcc42bff766356b6207ecd0.tar.gz servo-ec9d0f21a6561f379fcc42bff766356b6207ecd0.zip |
Format components fallible and geometry #21373
Diffstat (limited to 'components/geometry/lib.rs')
-rw-r--r-- | components/geometry/lib.rs | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/components/geometry/lib.rs b/components/geometry/lib.rs index c4bb9721bf6..22453483d15 100644 --- a/components/geometry/lib.rs +++ b/components/geometry/lib.rs @@ -6,7 +6,8 @@ extern crate app_units; extern crate euclid; extern crate malloc_size_of; extern crate style_traits; -#[macro_use] extern crate malloc_size_of_derive; +#[macro_use] +extern crate malloc_size_of_derive; extern crate webrender_api; use app_units::{Au, MAX_AU, MIN_AU}; @@ -48,7 +49,7 @@ impl MaxRect for Rect<Au> { fn max_rect() -> Rect<Au> { Rect::new( Point2D::new(MIN_AU / 2, MIN_AU / 2), - Size2D::new(MAX_AU, MAX_AU) + Size2D::new(MAX_AU, MAX_AU), ) } } @@ -64,12 +65,22 @@ impl MaxRect for LayoutRect { /// A helper function to convert a rect of `f32` pixels to a rect of app units. pub fn f32_rect_to_au_rect(rect: Rect<f32>) -> Rect<Au> { - Rect::new(Point2D::new(Au::from_f32_px(rect.origin.x), Au::from_f32_px(rect.origin.y)), - Size2D::new(Au::from_f32_px(rect.size.width), Au::from_f32_px(rect.size.height))) + Rect::new( + Point2D::new( + Au::from_f32_px(rect.origin.x), + Au::from_f32_px(rect.origin.y), + ), + Size2D::new( + Au::from_f32_px(rect.size.width), + Au::from_f32_px(rect.size.height), + ), + ) } /// A helper function to convert a rect of `Au` pixels to a rect of f32 units. pub fn au_rect_to_f32_rect(rect: Rect<Au>) -> Rect<f32> { - Rect::new(Point2D::new(rect.origin.x.to_f32_px(), rect.origin.y.to_f32_px()), - Size2D::new(rect.size.width.to_f32_px(), rect.size.height.to_f32_px())) + Rect::new( + Point2D::new(rect.origin.x.to_f32_px(), rect.origin.y.to_f32_px()), + Size2D::new(rect.size.width.to_f32_px(), rect.size.height.to_f32_px()), + ) } |