nimiq / core-rs

Official Rust implementation of the Nimiq protocol
https://nimiq.com
Other
74 stars 10 forks source link

`AddressParseError`doesn't implement `std::fmt::Display` #26

Closed jgraef closed 5 years ago

jgraef commented 5 years ago

I ran into this multiple times, but never got the time to fix it. So here is the issue open for anyone to fix. Or I will fix it, once I got some spare time.

error[E0277]: `keys::AddressParseError` doesn't implement `std::fmt::Display`
  --> src/config.rs:52:53
   |
52 |     Address::from_user_friendly_address(&s).map_err(Error::custom)
   |                                                     ^^^^^^^^^^^^^ `keys::AddressParseError` cannot be formatted with the default formatter
   |
   = help: the trait `std::fmt::Display` is not implemented for `keys::AddressParseError`
   = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
   = note: required by `config::_IMPL_DESERIALIZE_FOR_GenesisConfig::_serde::de::Error::custom`

Since keys::AddressParseError is an error, we should also implement the necessary traits.

jgraef commented 5 years ago

The error type keys::AddressParseError is an enum. We already use enum_display_derive at some places. So this would be an easy fix.

jgraef commented 5 years ago

Fixed with commit e596e79ac70815055f5a068143ab5dabb15a63e7