EpicCash / epic

Blockchain Node Server with integrated Stratum Mining Server
https://epiccash.com
Apache License 2.0
24 stars 36 forks source link

Remove usage of deprecated 'description' in errors #106

Closed who-biz closed 9 months ago

who-biz commented 9 months ago

This PR removes all usage of std::error::Error::description().

It has been deprecated since Rust 1.42. Instead, we need to implement Display for all relevant errors OR use to_string()

None of these were very helpful, to begin with. It is impossible to move variable data up to higher levels in code with description() anyway, as it requires a string literal in return.

There is now better tooling in functions such as source(), which does allow us to pass errors from lower levels to higher ones.

Mostly removal of old/unused code. Brings us into compatibility with future versions of rust, as far as std::error::Error trait is concerned.

Silences the following warnings:

warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
   --> keychain/src/extkey_bip32.rs:338:41
    |
338 |             Error::Ecdsa(ref e) => error::Error::description(e),
    |                                                  ^^^^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default
warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
  --> core/src/core/foundation.rs:52:68
   |
52 |         Err(why) => panic!("Couldn't create {}: {}", path.display(), why.description()),
   |                                                                          ^^^^^^^^^^^
   |
   = note: `#[warn(deprecated)]` on by default