From 324e5d0258c623af56b4d71ac18453379c271664 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Sat, 28 Mar 2020 03:12:36 +0300 Subject: [PATCH] Use slice pattern to parse KML coordinates --- src/location.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/location.rs b/src/location.rs index 5d86b3028..4c16fcbe6 100644 --- a/src/location.rs +++ b/src/location.rs @@ -123,9 +123,9 @@ impl Kml { } } else if self.tag.contains(KmlTag::COORDINATES) { let parts = val.splitn(2, ',').collect::>(); - if parts.len() == 2 { - self.curr.longitude = parts[0].parse().unwrap_or_default(); - self.curr.latitude = parts[1].parse().unwrap_or_default(); + if let [longitude, latitude] = &parts[..] { + self.curr.longitude = longitude.parse().unwrap_or_default(); + self.curr.latitude = latitude.parse().unwrap_or_default(); } } }