raymon1 / financial

Financial is a Rust crate that contains collection of finance calculations memicking some of Excel Financial Functions interface.
https://docs.rs/crate/financial
14 stars 5 forks source link

do not use format!() in assert!() #7

Closed shrektan closed 2 years ago

shrektan commented 2 years ago

The compiler said it will an error in Rust 2021

warning: panic message is not a string literal
  --> src/periodic_cashflow/irr.rs:62:13
   |
62 | /             format!(
63 | |                 "exceeded {} IRR precision threshold, {}",
64 | |                 irr(&cf, guess).unwrap(),
65 | |                 precision
66 | |             )
   | |_____________^
   |
   = note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
   = note: the assert!() macro supports formatting, so there's no need for the format!() macro here
help: remove the `format!(..)` macro call
   |
62 ~             
63 |                 "exceeded {} IRR precision threshold, {}",
64 |                 irr(&cf, guess).unwrap(),
65 |                 precision
66 ~             
   |