Skip to content

feature(data_structures): switch block time when v2.0 activates

Sign in for the full log view
GitHub Actions / clippy failed Jul 15, 2024 in 0s

clippy

11 errors

Details

Results

Message level Amount
Internal compiler error 0
Error 11
Warning 0
Note 0
Help 0

Versions

  • rustc 1.79.0 (129f3b996 2024-06-10)
  • cargo 1.79.0 (ffa9cf99a 2024-06-03)
  • clippy 0.1.79 (129f3b9 2024-06-10)

Annotations

Check failure on line 168 in data_structures/src/wit.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `u8` to `u32` may become silently lossy if you later change the type

error: casting `u8` to `u32` may become silently lossy if you later change the type
   --> data_structures/src/wit.rs:168:27
    |
168 |         self / 10_u64.pow(digits as u32)
    |                           ^^^^^^^^^^^^^ help: try: `u32::from(digits)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless

Check failure on line 997 in data_structures/src/staking/stakes.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unnecessary map of the identity function

error: unnecessary map of the identity function
   --> data_structures/src/staking/stakes.rs:996:21
    |
996 |               .take(4)
    |  _____________________^
997 | |             .map(|sk| sk)
    | |_________________________^ help: remove the call to `map`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_identity
    = note: `-D clippy::map-identity` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::map_identity)]`

Check failure on line 439 in data_structures/src/staking/stakes.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

returning the result of a `let` binding from a block

error: returning the result of a `let` binding from a block
   --> data_structures/src/staking/stakes.rs:439:9
    |
428 | /         let valid_staking_pair = if !self.by_validator.contains_key(&validator) {
429 | |             Ok(())
430 | |         } else {
431 | |             let stake_key = StakeKey::from((validator.clone(), withdrawer));
...   |
436 | |             }
437 | |         };
    | |__________- unnecessary `let` binding
438 |
439 |           valid_staking_pair
    |           ^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
    = note: `-D clippy::let-and-return` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::let_and_return)]`
help: return the expression directly
    |
428 ~         
429 | 
430 ~         if !self.by_validator.contains_key(&validator) {
431 +             Ok(())
432 +         } else {
433 +             let stake_key = StakeKey::from((validator.clone(), withdrawer));
434 +             if self.by_key.contains_key(&stake_key) {
435 +                 Ok(())
436 +             } else {
437 +                 Err(StakesError::DifferentWithdrawer { validator })
438 +             }
439 +         }
    |

Check failure on line 168 in data_structures/src/wit.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `u8` to `u32` may become silently lossy if you later change the type

error: casting `u8` to `u32` may become silently lossy if you later change the type
   --> data_structures/src/wit.rs:168:27
    |
168 |         self / 10_u64.pow(digits as u32)
    |                           ^^^^^^^^^^^^^ help: try: `u32::from(digits)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless

Check failure on line 439 in data_structures/src/staking/stakes.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

returning the result of a `let` binding from a block

error: returning the result of a `let` binding from a block
   --> data_structures/src/staking/stakes.rs:439:9
    |
428 | /         let valid_staking_pair = if !self.by_validator.contains_key(&validator) {
429 | |             Ok(())
430 | |         } else {
431 | |             let stake_key = StakeKey::from((validator.clone(), withdrawer));
...   |
436 | |             }
437 | |         };
    | |__________- unnecessary `let` binding
438 |
439 |           valid_staking_pair
    |           ^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
    = note: `-D clippy::let-and-return` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::let_and_return)]`
help: return the expression directly
    |
428 ~         
429 | 
430 ~         if !self.by_validator.contains_key(&validator) {
431 +             Ok(())
432 +         } else {
433 +             let stake_key = StakeKey::from((validator.clone(), withdrawer));
434 +             if self.by_key.contains_key(&stake_key) {
435 +                 Ok(())
436 +             } else {
437 +                 Err(StakesError::DifferentWithdrawer { validator })
438 +             }
439 +         }
    |

Check failure on line 4560 in data_structures/src/chain/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `u16` to `i64` may become silently lossy if you later change the type

error: casting `u16` to `i64` may become silently lossy if you later change the type
    --> data_structures/src/chain/mod.rs:4560:19
     |
4560 |                 / self.checkpoints_period as i64) as u32;
     |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `i64::from(self.checkpoints_period)`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
     = note: requested on the command line with `-D clippy::cast-lossless`

Check failure on line 4560 in data_structures/src/chain/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `i64` to `u32` may lose the sign of the value

error: casting `i64` to `u32` may lose the sign of the value
    --> data_structures/src/chain/mod.rs:4558:33
     |
4558 |               let epochs_pre_v2 = ((self.checkpoint_zero_timestamp_v2
     |  _________________________________^
4559 | |                 - self.checkpoint_zero_timestamp)
4560 | |                 / self.checkpoints_period as i64) as u32;
     | |________________________________________________________^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
     = note: requested on the command line with `-D clippy::cast-sign-loss`

Check failure on line 4560 in data_structures/src/chain/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `i64` to `u32` may truncate the value

error: casting `i64` to `u32` may truncate the value
    --> data_structures/src/chain/mod.rs:4558:33
     |
4558 |               let epochs_pre_v2 = ((self.checkpoint_zero_timestamp_v2
     |  _________________________________^
4559 | |                 - self.checkpoint_zero_timestamp)
4560 | |                 / self.checkpoints_period as i64) as u32;
     | |________________________________________________________^
     |
     = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation
     = note: requested on the command line with `-D clippy::cast-possible-truncation`
help: ... or use `try_from` and handle the error accordingly
     |
4558 ~             let epochs_pre_v2 = u32::try_from((self.checkpoint_zero_timestamp_v2
4559 ~                 - self.checkpoint_zero_timestamp) / self.checkpoints_period as i64);
     |

Check failure on line 4560 in data_structures/src/chain/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `u16` to `i64` may become silently lossy if you later change the type

error: casting `u16` to `i64` may become silently lossy if you later change the type
    --> data_structures/src/chain/mod.rs:4560:19
     |
4560 |                 / self.checkpoints_period as i64) as u32;
     |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `i64::from(self.checkpoints_period)`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
     = note: requested on the command line with `-D clippy::cast-lossless`

Check failure on line 4560 in data_structures/src/chain/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `i64` to `u32` may lose the sign of the value

error: casting `i64` to `u32` may lose the sign of the value
    --> data_structures/src/chain/mod.rs:4558:33
     |
4558 |               let epochs_pre_v2 = ((self.checkpoint_zero_timestamp_v2
     |  _________________________________^
4559 | |                 - self.checkpoint_zero_timestamp)
4560 | |                 / self.checkpoints_period as i64) as u32;
     | |________________________________________________________^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
     = note: requested on the command line with `-D clippy::cast-sign-loss`

Check failure on line 4560 in data_structures/src/chain/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `i64` to `u32` may truncate the value

error: casting `i64` to `u32` may truncate the value
    --> data_structures/src/chain/mod.rs:4558:33
     |
4558 |               let epochs_pre_v2 = ((self.checkpoint_zero_timestamp_v2
     |  _________________________________^
4559 | |                 - self.checkpoint_zero_timestamp)
4560 | |                 / self.checkpoints_period as i64) as u32;
     | |________________________________________________________^
     |
     = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation
     = note: requested on the command line with `-D clippy::cast-possible-truncation`
help: ... or use `try_from` and handle the error accordingly
     |
4558 ~             let epochs_pre_v2 = u32::try_from((self.checkpoint_zero_timestamp_v2
4559 ~                 - self.checkpoint_zero_timestamp) / self.checkpoints_period as i64);
     |