From 7688c54fb86bdd3af52fb968eddba788ae2ea357 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Tue, 18 Apr 2023 13:41:56 -0400 Subject: [PATCH] Fix more clippy lints --- spatial-coordinate-systems/src/latlon.rs | 6 +++--- spatial-coordinate-systems/src/utm.rs | 2 +- src/lib.rs | 3 ++- xpin-wasm/src/lib.rs | 12 +++++------- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/spatial-coordinate-systems/src/latlon.rs b/spatial-coordinate-systems/src/latlon.rs index e5049f9..9c979ad 100644 --- a/spatial-coordinate-systems/src/latlon.rs +++ b/spatial-coordinate-systems/src/latlon.rs @@ -67,9 +67,9 @@ impl fmt::Display for LatLon { } } -impl Into<(f64, f64)> for LatLon { - fn into(self) -> (f64, f64) { - (self.lat, self.lon) +impl From for (f64, f64) { + fn from(val: LatLon) -> Self { + (val.lat, val.lon) } } diff --git a/spatial-coordinate-systems/src/utm.rs b/spatial-coordinate-systems/src/utm.rs index 803605d..6ebddcd 100644 --- a/spatial-coordinate-systems/src/utm.rs +++ b/spatial-coordinate-systems/src/utm.rs @@ -112,7 +112,7 @@ impl TryFrom for Coordinate { zone_letter, easting, northing, - latlon: latlon, + latlon, }) } } diff --git a/src/lib.rs b/src/lib.rs index 070e31b..ad242c5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -168,7 +168,8 @@ impl Address<'_> { let mut words = vec![]; for word in word_components { - words::get_word(word).map_or_else(|| errors.push(word.to_ascii_uppercase()), |w| words.push(w)); + words::get_word(word) + .map_or_else(|| errors.push(word.to_ascii_uppercase()), |w| words.push(w)); } if !errors.is_empty() { diff --git a/xpin-wasm/src/lib.rs b/xpin-wasm/src/lib.rs index 43f1070..d98f600 100644 --- a/xpin-wasm/src/lib.rs +++ b/xpin-wasm/src/lib.rs @@ -27,7 +27,7 @@ pub struct EncodedAddress { impl EncodedAddress { #[wasm_bindgen(js_name = getCoordsType)] pub fn get_coords_type(&self) -> CoordinateType { - self.src_coords.get_type().into() + self.src_coords.get_type() } /// Get the string representation of the encoded value @@ -43,7 +43,7 @@ impl EncodedAddress { self.src_coords // TODO: Remove the clone here .clone() - .try_as_type(&coordinate_type.into()) + .try_as_type(&coordinate_type) .ok() .map(|s| s.to_string()) } @@ -135,12 +135,10 @@ impl TryFrom for EncodedAddress { address: addr.to_string(), lat_lon: Box::new([addr_lat, addr_lon]), src_coords: src_coords - .try_as_type(&src_coords.get_type().into()) - .map_err(|e| e.to_string())? - .into(), + .try_as_type(&src_coords.get_type()) + .map_err(|e| e.to_string())?, coordinate_urls: CoordinateUrls::try_from(addr_coordinates.latlon) - .map_err(|e| e.to_string())? - .into(), + .map_err(|e| e.to_string())?, decimal_degrees: format!("{}, {}", addr_lat, addr_lon), all_coordinates: Coordinates::from(&addr_coordinates), })