dfinity / nns-dapp

The Dapp of the Internet Computer's Network Nervous System.
https://nns.ic0.app/
Other
112 stars 38 forks source link

Update rust version to 1.82.0 #5646

Closed dskloetd closed 2 weeks ago

dskloetd commented 2 weeks ago

Motivation

The automatic update PR had lint failures because Rust 1.82.0 wants a different syntax for type casts from u64 to u128.

error: casts from `u64` to `u128` can be expressed infallibly using `From`
   --> rs/backend/src/tvl.rs:171:27
    |
171 |         let locked_u128 = state.total_locked_icp_e8s as u128;
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: an `as` cast can become silently lossy if the types change in the future
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
    = note: `-D clippy::cast-lossless` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::cast_lossless)]`
help: use `u128::from` instead
    |
171 |         let locked_u128 = u128::from(state.total_locked_icp_e8s);
    |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Changes

  1. Update Rust version to 1.82.0.
  2. Update code to use u128::from syntax for casts from u64 to u128.

Tests

scripts/lint-rs passes again.

Todos