diff --git a/src/macros.rs b/src/macros.rs index f937b5e2..ea6b09a6 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -106,12 +106,15 @@ macro_rules! user_enum { } impl ::std::str::FromStr for $name { - type Err = ::serde::de::value::Error; + type Err = ::std::io::Error; #[inline] fn from_str(s: &str) -> Result { match s { $($txt => Ok($name::$elem)),*, - _ => Err(::serde::de::Error::syntax(stringify!(s))) + _ => Err(::std::io::Error::new( + ::std::io::ErrorKind::InvalidInput, + format!("Unknown network (type {})", s), + )), } } } diff --git a/src/network/constants.rs b/src/network/constants.rs index 228f78c4..6c105158 100644 --- a/src/network/constants.rs +++ b/src/network/constants.rs @@ -90,8 +90,8 @@ mod tests { assert_eq!(Network::Bitcoin.to_string(), "bitcoin"); assert_eq!(Network::Testnet.to_string(), "testnet"); - assert_eq!("bitcoin".parse(), Ok(Network::Bitcoin)); - assert_eq!("testnet".parse(), Ok(Network::Testnet)); + assert_eq!("bitcoin".parse::().unwrap(), Network::Bitcoin); + assert_eq!("testnet".parse::().unwrap(), Network::Testnet); assert!("fakenet".parse::().is_err()); } }