diff --git a/crates/bevy_ui/src/geometry.rs b/crates/bevy_ui/src/geometry.rs index 8dcfee4302..2e11075bca 100644 --- a/crates/bevy_ui/src/geometry.rs +++ b/crates/bevy_ui/src/geometry.rs @@ -335,26 +335,9 @@ pub struct UiRect { } impl UiRect { - pub const DEFAULT: Self = Self { - left: Val::ZERO, - right: Val::ZERO, - top: Val::ZERO, - bottom: Val::ZERO, - }; - - pub const ZERO: Self = Self { - left: Val::ZERO, - right: Val::ZERO, - top: Val::ZERO, - bottom: Val::ZERO, - }; - - pub const AUTO: Self = Self { - left: Val::Auto, - right: Val::Auto, - top: Val::Auto, - bottom: Val::Auto, - }; + pub const DEFAULT: Self = Self::all(Val::ZERO); + pub const ZERO: Self = Self::all(Val::ZERO); + pub const AUTO: Self = Self::all(Val::Auto); /// Creates a new [`UiRect`] from the values specified. /// @@ -826,15 +809,7 @@ mod tests { #[test] fn uirect_default_equals_const_default() { - assert_eq!( - UiRect::default(), - UiRect { - left: Val::ZERO, - right: Val::ZERO, - top: Val::ZERO, - bottom: Val::ZERO - } - ); + assert_eq!(UiRect::default(), UiRect::all(Val::ZERO)); assert_eq!(UiRect::default(), UiRect::DEFAULT); }