diff --git a/spatial-coordinate-systems/src/dd.rs b/spatial-coordinate-systems/src/dd.rs index b69f0b8..107fbe4 100644 --- a/spatial-coordinate-systems/src/dd.rs +++ b/spatial-coordinate-systems/src/dd.rs @@ -101,10 +101,10 @@ impl TryFrom for Coordinate { } impl FromStr for Coordinate { - type Err = (); + type Err = Error; fn from_str(i: &str) -> Result { - Self::parse(i).map_err(|_| ()).map(|(_, ret)| ret) + Self::parse(i).map_err(Into::into).map(|(_, ret)| ret) } } diff --git a/spatial-coordinate-systems/src/dmm.rs b/spatial-coordinate-systems/src/dmm.rs index b0e4a30..b6f73a7 100644 --- a/spatial-coordinate-systems/src/dmm.rs +++ b/spatial-coordinate-systems/src/dmm.rs @@ -42,10 +42,10 @@ impl Coordinate { } impl FromStr for Coordinate { - type Err = (); + type Err = Error; fn from_str(i: &str) -> Result { - Self::parse(i).map_err(|_| ()).map(|(_, ret)| ret) + Self::parse(i).map_err(Into::into).map(|(_, ret)| ret) } } diff --git a/spatial-coordinate-systems/src/dms.rs b/spatial-coordinate-systems/src/dms.rs index 5dfd686..34cca40 100644 --- a/spatial-coordinate-systems/src/dms.rs +++ b/spatial-coordinate-systems/src/dms.rs @@ -134,10 +134,10 @@ impl DMS { } impl FromStr for Coordinate { - type Err = (); + type Err = Error; fn from_str(i: &str) -> Result { - Self::parse(i).map_err(|_| ()).map(|(_, ret)| ret) + Self::parse(i).map_err(Into::into).map(|(_, ret)| ret) } } diff --git a/spatial-coordinate-systems/src/plus.rs b/spatial-coordinate-systems/src/plus.rs index 4e73d6b..22d9f7d 100644 --- a/spatial-coordinate-systems/src/plus.rs +++ b/spatial-coordinate-systems/src/plus.rs @@ -1,3 +1,4 @@ +use crate::Error; use crate::LatLon; use nom::{bytes::complete::take_while, combinator::map_opt, IResult}; use std::{fmt, str::FromStr}; @@ -29,10 +30,10 @@ impl Coordinate { } impl FromStr for Coordinate { - type Err = (); + type Err = Error; fn from_str(i: &str) -> Result { - Self::parse(i).map_err(|_| ()).map(|(_, ret)| ret) + Self::parse(i).map_err(Into::into).map(|(_, ret)| ret) } } diff --git a/spatial-coordinate-systems/src/utm.rs b/spatial-coordinate-systems/src/utm.rs index 157cb59..d8ad614 100644 --- a/spatial-coordinate-systems/src/utm.rs +++ b/spatial-coordinate-systems/src/utm.rs @@ -134,8 +134,6 @@ mod tests { let cvt = Coordinate::from_str($tt); eprintln!("Testing: {} => {:?}", $tt, cvt); assert!(cvt.is_ok()); - eprintln!("Now converting to latlon"); - // assert!(dbg!(TryInto::::try_into(cvt.unwrap())).is_ok()); }}; }