Cleanup error reporting
This commit is contained in:
parent
93523beb37
commit
8c6fff2a3b
@ -101,10 +101,10 @@ impl TryFrom<LatLon> for Coordinate {
|
||||
}
|
||||
|
||||
impl FromStr for Coordinate {
|
||||
type Err = ();
|
||||
type Err = Error;
|
||||
|
||||
fn from_str(i: &str) -> Result<Self, Self::Err> {
|
||||
Self::parse(i).map_err(|_| ()).map(|(_, ret)| ret)
|
||||
Self::parse(i).map_err(Into::into).map(|(_, ret)| ret)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,10 +42,10 @@ impl Coordinate {
|
||||
}
|
||||
|
||||
impl FromStr for Coordinate {
|
||||
type Err = ();
|
||||
type Err = Error;
|
||||
|
||||
fn from_str(i: &str) -> Result<Self, Self::Err> {
|
||||
Self::parse(i).map_err(|_| ()).map(|(_, ret)| ret)
|
||||
Self::parse(i).map_err(Into::into).map(|(_, ret)| ret)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,10 +134,10 @@ impl DMS {
|
||||
}
|
||||
|
||||
impl FromStr for Coordinate {
|
||||
type Err = ();
|
||||
type Err = Error;
|
||||
|
||||
fn from_str(i: &str) -> Result<Self, Self::Err> {
|
||||
Self::parse(i).map_err(|_| ()).map(|(_, ret)| ret)
|
||||
Self::parse(i).map_err(Into::into).map(|(_, ret)| ret)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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, Self::Err> {
|
||||
Self::parse(i).map_err(|_| ()).map(|(_, ret)| ret)
|
||||
Self::parse(i).map_err(Into::into).map(|(_, ret)| ret)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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::<LatLon>::try_into(cvt.unwrap())).is_ok());
|
||||
}};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user