Skip to content

fix(stakes): add missing doc #106

fix(stakes): add missing doc

fix(stakes): add missing doc #106

Triggered via push June 28, 2024 08:21
Status Failure
Total duration 17m 53s
Artifacts

push.yml

on: push
Fit to window
Zoom out
Zoom in

Annotations

14 errors and 6 warnings
unnecessary map of the identity function: data_structures/src/staking/stakes.rs#L995
error: unnecessary map of the identity function --> data_structures/src/staking/stakes.rs:995:21 | 995 | .take(4) | _____________________^ 996 | | .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)]`
returning the result of a `let` binding from a block: data_structures/src/staking/stakes.rs#L438
error: returning the result of a `let` binding from a block --> data_structures/src/staking/stakes.rs:438:9 | 427 | / let valid_staking_pair = if !self.by_validator.contains_key(&validator) { 428 | | Ok(()) 429 | | } else { 430 | | let stake_key = StakeKey::from((validator.clone(), withdrawer)); ... | 435 | | } 436 | | }; | |__________- unnecessary `let` binding 437 | 438 | 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 | 427 ~ 428 | 429 ~ if !self.by_validator.contains_key(&validator) { 430 + Ok(()) 431 + } else { 432 + let stake_key = StakeKey::from((validator.clone(), withdrawer)); 433 + if self.by_key.contains_key(&stake_key) { 434 + Ok(()) 435 + } else { 436 + Err(StakesError::DifferentWithdrawer { validator }) 437 + } 438 + } |
field assignment outside of initializer for an instance created with Default::default(): data_structures/src/staking/stakes.rs#L359
error: field assignment outside of initializer for an instance created with Default::default() --> data_structures/src/staking/stakes.rs:359:9 | 359 | stakes.by_key = entries; | ^^^^^^^^^^^^^^^^^^^^^^^^ | note: consider initializing the variable with `Stakes::<Address, Coins, Epoch, Power> { by_key: entries, ..Default::default() }` and removing relevant reassignments --> data_structures/src/staking/stakes.rs:358:9 | 358 | let mut stakes = Stakes::default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default = note: `-D clippy::field-reassign-with-default` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::field_reassign_with_default)]`
returning the result of a `let` binding from a block: data_structures/src/staking/stakes.rs#L438
error: returning the result of a `let` binding from a block --> data_structures/src/staking/stakes.rs:438:9 | 427 | / let valid_staking_pair = if !self.by_validator.contains_key(&validator) { 428 | | Ok(()) 429 | | } else { 430 | | let stake_key = StakeKey::from((validator.clone(), withdrawer)); ... | 435 | | } 436 | | }; | |__________- unnecessary `let` binding 437 | 438 | 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 | 427 ~ 428 | 429 ~ if !self.by_validator.contains_key(&validator) { 430 + Ok(()) 431 + } else { 432 + let stake_key = StakeKey::from((validator.clone(), withdrawer)); 433 + if self.by_key.contains_key(&stake_key) { 434 + Ok(()) 435 + } else { 436 + Err(StakesError::DifferentWithdrawer { validator }) 437 + } 438 + } |
field assignment outside of initializer for an instance created with Default::default(): data_structures/src/staking/stakes.rs#L359
error: field assignment outside of initializer for an instance created with Default::default() --> data_structures/src/staking/stakes.rs:359:9 | 359 | stakes.by_key = entries; | ^^^^^^^^^^^^^^^^^^^^^^^^ | note: consider initializing the variable with `Stakes::<Address, Coins, Epoch, Power> { by_key: entries, ..Default::default() }` and removing relevant reassignments --> data_structures/src/staking/stakes.rs:358:9 | 358 | let mut stakes = Stakes::default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default = note: `-D clippy::field-reassign-with-default` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::field_reassign_with_default)]`
casting `u16` to `i64` may become silently lossy if you later change the type: data_structures/src/chain/mod.rs#L4560
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`
casting `i64` to `u32` may lose the sign of the value: data_structures/src/chain/mod.rs#L4558
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`
casting `i64` to `u32` may truncate the value: data_structures/src/chain/mod.rs#L4558
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); |
casting `u16` to `i64` may become silently lossy if you later change the type: data_structures/src/chain/mod.rs#L4560
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`
casting `i64` to `u32` may lose the sign of the value: data_structures/src/chain/mod.rs#L4558
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`
casting `i64` to `u32` may truncate the value: data_structures/src/chain/mod.rs#L4558
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); |
build_ubuntu
could not compile `witnet_data_structures` (lib) due to 6 previous errors
build_ubuntu
could not compile `witnet_data_structures` (lib test) due to 7 previous errors
build_ubuntu
Clippy had exited with the 101 exit code
build_ubuntu
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions-rs/toolchain@v1, actions-rs/cargo@v1, actions-rs/clippy-check@v1. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
build_ubuntu
The following actions uses node12 which is deprecated and will be forced to run on node16: actions-rs/toolchain@v1, actions-rs/cargo@v1, actions-rs/clippy-check@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
build_ubuntu
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
build_ubuntu
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
build_ubuntu
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
build_ubuntu
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/