Fix more clippy lints
This commit is contained in:
parent
030272f915
commit
7688c54fb8
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ impl TryFrom<LatLon> for Coordinate {
|
||||
zone_letter,
|
||||
easting,
|
||||
northing,
|
||||
latlon: latlon,
|
||||
latlon,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -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() {
|
||||
|
@ -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),
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user