Fix more clippy lints

This commit is contained in:
Austen Adler 2023-04-18 13:41:56 -04:00
parent 030272f915
commit 7688c54fb8
4 changed files with 11 additions and 12 deletions

View File

@ -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<LatLon> for (f64, f64) {
fn from(val: LatLon) -> Self {
(val.lat, val.lon)
}
}

View File

@ -112,7 +112,7 @@ impl TryFrom<LatLon> for Coordinate {
zone_letter,
easting,
northing,
latlon: latlon,
latlon,
})
}
}

View File

@ -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() {

View File

@ -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<Coordinate> 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),
})