From 0448d4316cd713e5df31d6a69a74065216f59639 Mon Sep 17 00:00:00 2001 From: jackevley Date: Mon, 22 Dec 2025 21:49:01 +0000 Subject: [PATCH] fix: simplify match statements for horizontal and vertical alignment conversions --- src/object_pool/object_attributes.rs | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/src/object_pool/object_attributes.rs b/src/object_pool/object_attributes.rs index d83fe84..303f6ea 100644 --- a/src/object_pool/object_attributes.rs +++ b/src/object_pool/object_attributes.rs @@ -381,15 +381,11 @@ pub enum HorizontalAlignment { impl From<[bool; 2]> for HorizontalAlignment { fn from(value: [bool; 2]) -> Self { - match value[0] { - false => match value[1] { - false => HorizontalAlignment::Left, - true => HorizontalAlignment::Middle, - }, - true => match value[1] { - false => HorizontalAlignment::Right, - true => HorizontalAlignment::Reserved, - }, + match value { + [false, false] => HorizontalAlignment::Left, + [true, false] => HorizontalAlignment::Middle, + [false, true] => HorizontalAlignment::Right, + [true, true] => HorizontalAlignment::Reserved, } } } @@ -415,15 +411,11 @@ pub enum VerticalAlignment { impl From<[bool; 2]> for VerticalAlignment { fn from(value: [bool; 2]) -> Self { - match value[0] { - false => match value[1] { - false => VerticalAlignment::Top, - true => VerticalAlignment::Middle, - }, - true => match value[1] { - false => VerticalAlignment::Bottom, - true => VerticalAlignment::Reserved, - }, + match value { + [false, false] => VerticalAlignment::Top, + [true, false] => VerticalAlignment::Middle, + [false, true] => VerticalAlignment::Bottom, + [true, true] => VerticalAlignment::Reserved, } } }