Byte-Unit icon indicating copy to clipboard operation
Byte-Unit copied to clipboard

fix: failing minimal-versions check for `rust_decimal`

Open sebadob opened this issue 1 year ago • 0 comments

rust_decimal needs to be at least v1.15 to not produce errors during

cargo minimal-versions check

Error output:

error[E0599]: no associated item named `ZERO` found for struct `rust_decimal::Decimal` in the current scope
  --> src/byte/decimal.rs:27:29
   |
27 |         if size >= Decimal::ZERO {
   |                             ^^^^ associated item not found in `Decimal`

error[E0277]: the trait bound `rust_decimal::Decimal: From<u128>` is not satisfied
  --> src/byte/decimal.rs:73:45
   |
73 |                 _ => match size.checked_mul(Decimal::from(unit.as_bytes_u128())) {
   |                                             ^^^^^^^ the trait `From<u128>` is not implemented for `rust_decimal::Decimal`
   |
   = help: the following other types implement trait `From<T>`:
             <rust_decimal::Decimal as From<i16>>
             <rust_decimal::Decimal as From<i32>>
             <rust_decimal::Decimal as From<i64>>
             <rust_decimal::Decimal as From<i8>>
             <rust_decimal::Decimal as From<isize>>
             <rust_decimal::Decimal as From<u16>>
             <rust_decimal::Decimal as From<u32>>
             <rust_decimal::Decimal as From<u64>>
           and 2 others

error[E0277]: the trait bound `rust_decimal::Decimal: From<u128>` is not satisfied
   --> src/byte/decimal.rs:133:24
    |
133 |         let bytes_vd = Decimal::from(bytes_v);
    |                        ^^^^^^^ the trait `From<u128>` is not implemented for `rust_decimal::Decimal`
    |
    = help: the following other types implement trait `From<T>`:
              <rust_decimal::Decimal as From<i16>>
              <rust_decimal::Decimal as From<i32>>
              <rust_decimal::Decimal as From<i64>>
              <rust_decimal::Decimal as From<i8>>
              <rust_decimal::Decimal as From<isize>>
              <rust_decimal::Decimal as From<u16>>
              <rust_decimal::Decimal as From<u32>>
              <rust_decimal::Decimal as From<u64>>
            and 2 others

error[E0277]: the trait bound `rust_decimal::Decimal: From<u128>` is not satisfied
   --> src/byte/decimal.rs:148:31
    |
148 |                 let unit_vd = Decimal::from(unit_v);
    |                               ^^^^^^^ the trait `From<u128>` is not implemented for `rust_decimal::Decimal`
    |
    = help: the following other types implement trait `From<T>`:
              <rust_decimal::Decimal as From<i16>>
              <rust_decimal::Decimal as From<i32>>
              <rust_decimal::Decimal as From<i64>>
              <rust_decimal::Decimal as From<i8>>
              <rust_decimal::Decimal as From<isize>>
              <rust_decimal::Decimal as From<u16>>
              <rust_decimal::Decimal as From<u32>>
              <rust_decimal::Decimal as From<u64>>
            and 2 others

error[E0599]: no associated item named `TEN` found for struct `rust_decimal::Decimal` in the current scope
  --> src/byte/parse.rs:47:51
   |
47 | ...                   .checked_mul(Decimal::TEN)
   |                                             ^^^ associated item not found in `Decimal`

error[E0599]: no associated item named `ZERO` found for struct `rust_decimal::Decimal` in the current scope
   --> src/common.rs:103:32
    |
103 |     debug_assert!(b > Decimal::ZERO);
    |                                ^^^^ associated item not found in `Decimal`

error[E0277]: the trait bound `rust_decimal::Decimal: From<u128>` is not satisfied
   --> src/common.rs:115:25
    |
115 |             let scale = Decimal::from(10u128.pow(precision as u32));
    |                         ^^^^^^^ the trait `From<u128>` is not implemented for `rust_decimal::Decimal`
    |
    = help: the following other types implement trait `From<T>`:
              <rust_decimal::Decimal as From<i16>>
              <rust_decimal::Decimal as From<i32>>
              <rust_decimal::Decimal as From<i64>>
              <rust_decimal::Decimal as From<i8>>
              <rust_decimal::Decimal as From<isize>>
              <rust_decimal::Decimal as From<u16>>
              <rust_decimal::Decimal as From<u32>>
              <rust_decimal::Decimal as From<u64>>
            and 2 others

Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
warning: `byte-unit` (lib) generated 8 warnings
error: could not compile `byte-unit` (lib) due to 7 previous errors; 8 warnings emitted
error: process didn't exit successfully: `/home/sd/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo check --manifest-path Cargo.toml` (exit status: 101)
error: process didn't exit successfully: `/home/sd/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo hack check` (exit status: 1)

sebadob avatar Aug 29 '24 10:08 sebadob