From 8766692781dee9fdfeee46965db5e057e8c85af6 Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Wed, 4 Oct 2023 16:34:04 -0400 Subject: [PATCH] Resolving linting problems in geo-types --- geo-types/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/geo-types/src/lib.rs b/geo-types/src/lib.rs index 6b8aebf..1bf0c05 100644 --- a/geo-types/src/lib.rs +++ b/geo-types/src/lib.rs @@ -5,7 +5,7 @@ pub struct Latitude(f32); impl From for Latitude { fn from(val: f32) -> Self { - if val > 90.0 || val < -90.0 { + if !(-90.0..=90.0).contains(&val) { panic!("Latitude is outside of range"); } Self(val) @@ -23,7 +23,7 @@ pub struct Longitude(f32); impl From for Longitude { fn from(val: f32) -> Self { - if val > 180.0 || val < -180.0 { + if !(-180.0..=180.0).contains(&val) { panic!("Longitude is outside fo range"); } Self(val)