From ce1a8c8c324052281516645af325e1b8a0d1305b Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Fri, 24 Mar 2023 16:20:56 -0400 Subject: [PATCH] Run clippy --fix --- src/conversions/wrap.rs | 2 +- web/src/static_assets.rs | 6 +++--- xpin-wasm/src/lib.rs | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/conversions/wrap.rs b/src/conversions/wrap.rs index 699a083..68ddae5 100644 --- a/src/conversions/wrap.rs +++ b/src/conversions/wrap.rs @@ -27,7 +27,7 @@ pub fn wrap_latlon(mut lat: f64, mut lon: f64) -> (f64, f64) { _ => {} } - if lon > 180_f64 || lon < -180_f64 { + if !(-180_f64..=180_f64).contains(&lon) { lon -= ((lon + 180_f64) / 360_f64).floor() * 360_f64; } diff --git a/web/src/static_assets.rs b/web/src/static_assets.rs index 0c8b75d..4fd72be 100644 --- a/web/src/static_assets.rs +++ b/web/src/static_assets.rs @@ -8,7 +8,7 @@ use web_frontend::Asset; #[get("/")] pub(crate) fn dist(file: PathBuf) -> Option<(ContentType, Cow<'static, [u8]>)> { - if let Some(a) = Asset::get(&format!("{}", file.display().to_string())) { + if let Some(a) = Asset::get(&format!("{}", file.display())) { let content_type = file .extension() .and_then(OsStr::to_str) @@ -19,12 +19,12 @@ pub(crate) fn dist(file: PathBuf) -> Option<(ContentType, Cow<'static, [u8]>)> { } [".html", "/index.html"].iter().find_map(|ext| { - Asset::get(&format!("{}{}", file.display().to_string(), ext)) + Asset::get(&format!("{}{}", file.display(), ext)) .map(|a| (ContentType::HTML, a.data)) }) } #[get("/")] pub(crate) fn index() -> Option<(ContentType, Cow<'static, [u8]>)> { - Asset::get(&"index.html").map(|a| (ContentType::HTML, a.data)) + Asset::get("index.html").map(|a| (ContentType::HTML, a.data)) } diff --git a/xpin-wasm/src/lib.rs b/xpin-wasm/src/lib.rs index ebc9a0f..c96cc4f 100644 --- a/xpin-wasm/src/lib.rs +++ b/xpin-wasm/src/lib.rs @@ -15,9 +15,9 @@ pub enum CoordinateType { Plus, } -impl Into for CoordinateType { - fn into(self) -> spatial_coordinate_systems::CoordinateType { - match self { +impl From for spatial_coordinate_systems::CoordinateType { + fn from(val: CoordinateType) -> Self { + match val { Self::DD => spatial_coordinate_systems::CoordinateType::DD, Self::DMS => spatial_coordinate_systems::CoordinateType::DMS, Self::DMM => spatial_coordinate_systems::CoordinateType::DMM, @@ -92,7 +92,7 @@ impl EncodedAddress { // TODO: Remove the clone here let latlon = LatLon::try_from(src_coords.clone()) - .map_err(|_| format!("Could not convert coordinate back to latlon"))?; + .map_err(|_| "Could not convert coordinate back to latlon".to_string())?; let mut ret = Self::try_from( xpin::Address::from_lat_lon(latlon.lat, latlon.lon)