Skip to content

feat(staking): discard nanoWits for average epoch computation when ad… #109

feat(staking): discard nanoWits for average epoch computation when ad…

feat(staking): discard nanoWits for average epoch computation when ad… #109

GitHub Actions / clippy failed Jul 4, 2024 in 0s

clippy

5 errors

Details

Results

Message level Amount
Internal compiler error 0
Error 5
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
    = note: requested on the command line with `-D clippy::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
    = note: requested on the command line with `-D clippy::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 +         }
    |