clippy
4 errors, 458 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 4 |
Warning | 458 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.77.2 (25ef9e3d8 2024-04-09)
- cargo 1.77.2 (e52e36006 2024-03-26)
- clippy 0.1.77 (25ef9e3 2024-04-09)
Annotations
Check warning on line 87 in node/src/watched_accounts/watched_accounts_reducer.rs
github-actions / clippy
casting to the same type is unnecessary (`u32` -> `u32`)
warning: casting to the same type is unnecessary (`u32` -> `u32`)
--> node/src/watched_accounts/watched_accounts_reducer.rs:79:36
|
79 | ... level: block
| ______________________________^
80 | | ... .block
81 | | ... .header
82 | | ... .protocol_state
... |
86 | | ... .0
87 | | ... .0 as u32,
| |____________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
help: try
|
79 ~ level: block
80 + .block
81 + .header
82 + .protocol_state
83 + .body
84 + .consensus_state
85 + .blockchain_length
86 + .0
87 ~ .0,
|
Check warning on line 137 in node/src/watched_accounts/watched_accounts_actions.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> node/src/watched_accounts/watched_accounts_actions.rs:137:40
|
137 | acc.block_find_by_hash(&block_hash)
| ^^^^^^^^^^^ help: change this to: `block_hash`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 180 in node/src/watched_accounts/watched_accounts_state.rs
github-actions / clippy
the following explicit lifetimes could be elided: 'a
warning: the following explicit lifetimes could be elided: 'a
--> node/src/watched_accounts/watched_accounts_state.rs:180:17
|
180 | pub fn iter<'a>(
| ^^
181 | &'a self,
| ^^
182 | ) -> impl 'a + Iterator<Item = (&'a NonZeroCurvePoint, &'a WatchedAccountState)> {
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
180 ~ pub fn iter(
181 ~ &self,
182 ~ ) -> impl '_ + Iterator<Item = (&'a NonZeroCurvePoint, &'a WatchedAccountState)> {
|
Check warning on line 162 in node/src/watched_accounts/watched_accounts_state.rs
github-actions / clippy
you should consider adding a `Default` implementation for `WatchedAccountsState`
warning: you should consider adding a `Default` implementation for `WatchedAccountsState`
--> node/src/watched_accounts/watched_accounts_state.rs:158:5
|
158 | / pub fn new() -> Self {
159 | | Self {
160 | | list: Default::default(),
161 | | }
162 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try adding this
|
157 + impl Default for WatchedAccountsState {
158 + fn default() -> Self {
159 + Self::new()
160 + }
161 + }
|
Check warning on line 98 in node/src/watched_accounts/watched_accounts_state.rs
github-actions / clippy
large size difference between variants
warning: large size difference between variants
--> node/src/watched_accounts/watched_accounts_state.rs:78:1
|
78 | / pub enum WatchedAccountBlockState {
79 | | /// Relevant transactions to the account has been included in the block.
80 | | / TransactionsInBlockBody {
81 | | | block: WatchedAccountBlockInfo,
82 | | | /// Transactions included in the block ordered by nonce from low to high.
83 | | | transactions: Vec<Transaction>,
84 | | | },
| | |_____- the second-largest variant contains at least 32 bytes
... |
92 | | / LedgerAccountGetSuccess {
93 | | | block: WatchedAccountBlockInfo,
94 | | | /// Transactions included in the block ordered by nonce from low to high.
95 | | | transactions: Vec<Transaction>,
96 | | | ledger_account: MinaBaseAccountBinableArgStableV2,
97 | | | },
| | |_____- the largest variant contains at least 784 bytes
98 | | }
| |___^ the entire enum is at least 0 bytes
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant
help: consider boxing the large fields to reduce the total size of the enum
|
96 | ledger_account: Box<MinaBaseAccountBinableArgStableV2>,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Check warning on line 54 in node/src/watched_accounts/watched_accounts_state.rs
github-actions / clippy
large size difference between variants
warning: large size difference between variants
--> node/src/watched_accounts/watched_accounts_state.rs:35:1
|
35 | / pub enum WatchedAccountLedgerInitialState {
36 | | Idle {
37 | | time: redux::Timestamp,
38 | | },
39 | | / Pending {
40 | | | time: redux::Timestamp,
41 | | | block: WatchedAccountBlockInfo,
42 | | | peer_id: PeerId,
43 | | | },
| | |_____- the second-largest variant contains at least 72 bytes
... |
49 | | / Success {
50 | | | time: redux::Timestamp,
51 | | | block: WatchedAccountBlockInfo,
52 | | | data: Option<MinaBaseAccountBinableArgStableV2>,
53 | | | },
| | |_____- the largest variant contains at least 792 bytes
54 | | }
| |___^ the entire enum is at least 0 bytes
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant
help: consider boxing the large fields to reduce the total size of the enum
|
52 | data: Box<Option<MinaBaseAccountBinableArgStableV2>>,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Check warning on line 81 in node/src/transition_frontier/sync/transition_frontier_sync_effects.rs
github-actions / clippy
this `if` has identical blocks
warning: this `if` has identical blocks
--> node/src/transition_frontier/sync/transition_frontier_sync_effects.rs:80:89
|
80 | if store.dispatch(TransitionFrontierSyncAction::LedgerNextEpochPending) {
| _________________________________________________________________________________________^
81 | | } else if store.dispatch(TransitionFrontierSyncAction::LedgerRootPending) {
| |_________________^
|
note: same as this
--> node/src/transition_frontier/sync/transition_frontier_sync_effects.rs:81:91
|
81 | } else if store.dispatch(TransitionFrontierSyncAction::LedgerRootPending) {
| ___________________________________________________________________________________________^
82 | | }
| |_________________^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else
Check warning on line 597 in node/src/transition_frontier/sync/transition_frontier_sync_reducer.rs
github-actions / clippy
writing `&Vec` instead of `&[_]` involves a new object where a slice will do
warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> node/src/transition_frontier/sync/transition_frontier_sync_reducer.rs:597:27
|
597 | new_blocks_inbetween: &Vec<StateHash>,
| ^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
= note: `#[warn(clippy::ptr_arg)]` on by default
help: change this to
|
597 ~ new_blocks_inbetween: &[StateHash],
598 | ) -> TransitionFrontierSyncState {
...
645 | root_block: new_root.clone(),
646 ~ blocks_inbetween: new_blocks_inbetween.to_owned(),
|
Check warning on line 455 in node/src/transition_frontier/sync/transition_frontier_sync_reducer.rs
github-actions / clippy
using `clone` on type `PeerId` which implements the `Copy` trait
warning: using `clone` on type `PeerId` which implements the `Copy` trait
--> node/src/transition_frontier/sync/transition_frontier_sync_reducer.rs:455:33
|
455 | attempts.insert(peer_id.clone(), PeerRpcState::Init { time: meta.time() });
| ^^^^^^^^^^^^^^^ help: try dereferencing it: `*peer_id`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
Check warning on line 446 in node/src/transition_frontier/sync/transition_frontier_sync_reducer.rs
github-actions / clippy
using `clone` on type `PeerId` which implements the `Copy` trait
warning: using `clone` on type `PeerId` which implements the `Copy` trait
--> node/src/transition_frontier/sync/transition_frontier_sync_reducer.rs:446:33
|
446 | attempts.insert(peer_id.clone(), PeerRpcState::Init { time: meta.time() });
| ^^^^^^^^^^^^^^^ help: try dereferencing it: `*peer_id`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
Check warning on line 244 in node/src/transition_frontier/sync/transition_frontier_sync_reducer.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> node/src/transition_frontier/sync/transition_frontier_sync_reducer.rs:244:22
|
244 | _ => return,
| ^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: replace `return` with a unit value
|
244 | _ => (),
| ~~
Check warning on line 491 in node/src/transition_frontier/sync/transition_frontier_sync_state.rs
github-actions / clippy
use of `filter_map` with an identity function
warning: use of `filter_map` with an identity function
--> node/src/transition_frontier/sync/transition_frontier_sync_state.rs:491:18
|
491 | .filter_map(|v| v),
| ^^^^^^^^^^^^^^^^^ help: try: `flatten()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#filter_map_identity
Check warning on line 82 in node/src/transition_frontier/sync/ledger/mod.rs
github-actions / clippy
this `if` has identical blocks
warning: this `if` has identical blocks
--> node/src/transition_frontier/sync/ledger/mod.rs:80:85
|
80 | if best_tip.next_epoch_ledger_hash() != root_block.next_epoch_ledger_hash() {
| _____________________________________________________________________________________^
81 | | return None;
82 | | } else if best_tip.next_epoch_ledger_hash() == best_tip.genesis_ledger_hash() {
| |_________^
|
note: same as this
--> node/src/transition_frontier/sync/ledger/mod.rs:82:87
|
82 | } else if best_tip.next_epoch_ledger_hash() == best_tip.genesis_ledger_hash() {
| _______________________________________________________________________________________^
83 | | return None;
84 | | }
| |_________^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else
github-actions / clippy
this `if` has identical blocks
warning: this `if` has identical blocks
--> node/src/transition_frontier/sync/ledger/transition_frontier_sync_ledger_effects.rs:21:90
|
21 | } else if store.dispatch(TransitionFrontierSyncLedgerStagedAction::ReconstructEmpty) {
| __________________________________________________________________________________________^
22 | | } else if store.dispatch(TransitionFrontierSyncLedgerStagedAction::PartsFetchPending) {
| |_____^
|
note: same as this
--> node/src/transition_frontier/sync/ledger/transition_frontier_sync_ledger_effects.rs:22:91
|
22 | } else if store.dispatch(TransitionFrontierSyncLedgerStagedAction::PartsFetchPending) {
| ___________________________________________________________________________________________^
23 | | }
| |_____^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else
github-actions / clippy
this `if` has identical blocks
warning: this `if` has identical blocks
--> node/src/transition_frontier/sync/ledger/transition_frontier_sync_ledger_effects.rs:20:68
|
20 | if store.dispatch(TransitionFrontierSyncLedgerAction::Success) {
| ____________________________________________________________________^
21 | | } else if store.dispatch(TransitionFrontierSyncLedgerStagedAction::ReconstructEmpty) {
| |_____^
|
note: same as this
--> node/src/transition_frontier/sync/ledger/transition_frontier_sync_ledger_effects.rs:21:90
|
21 | } else if store.dispatch(TransitionFrontierSyncLedgerStagedAction::ReconstructEmpty) {
| __________________________________________________________________________________________^
22 | | } else if store.dispatch(TransitionFrontierSyncLedgerStagedAction::PartsFetchPending) {
| |_____^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else
= note: `#[warn(clippy::if_same_then_else)]` on by default
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> node/src/transition_frontier/sync/ledger/transition_frontier_sync_ledger_reducer.rs:63:30
|
63 | _ => return,
| ^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: replace `return` with a unit value
|
63 | _ => (),
| ~~
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> node/src/transition_frontier/sync/ledger/staged/transition_frontier_sync_ledger_staged_state.rs:137:40
|
137 | !attempts.contains_key(&peer_id)
| ^^^^^^^^ help: change this to: `peer_id`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
github-actions / clippy
redundant pattern matching, consider using `is_err()`
warning: redundant pattern matching, consider using `is_err()`
--> node/src/transition_frontier/sync/ledger/snarked/transition_frontier_sync_ledger_snarked_effects.rs:424:24
|
424 | if let Err(_) = compute_hashes_result {
| -------^^^^^^------------------------ help: try: `if compute_hashes_result.is_err()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
= note: `#[warn(clippy::redundant_pattern_matching)]` on by default
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> node/src/transition_frontier/sync/ledger/snarked/transition_frontier_sync_ledger_snarked_state.rs:237:17
|
237 | / return Some(LedgerSyncProgress {
238 | | fetched: 1,
239 | | estimation: 1,
240 | | })
| |__________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
237 ~ Some(LedgerSyncProgress {
238 + fetched: 1,
239 + estimation: 1,
240 + })
|
github-actions / clippy
you are using an explicit closure for cloning elements
warning: you are using an explicit closure for cloning elements
--> node/src/transition_frontier/sync/ledger/snarked/transition_frontier_sync_ledger_snarked_state.rs:201:64
|
201 | Self::MerkleTreeSyncPending { queue, .. } => match queue.front().map(|a| a.clone()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `queue.front().cloned()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone
= note: `#[warn(clippy::map_clone)]` on by default
github-actions / clippy
match expression looks like `matches!` macro
warning: match expression looks like `matches!` macro
--> node/src/transition_frontier/sync/ledger/snarked/transition_frontier_sync_ledger_snarked_state.rs:161:9
|
161 | / match self {
162 | | Self::NumAccountsPending { .. } => true,
163 | | _ => false,
164 | | }
| |_________^ help: try: `matches!(self, Self::NumAccountsPending { .. })`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
github-actions / clippy
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Vec`
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Vec`
--> node/src/transition_frontier/genesis/transition_frontier_genesis_config.rs:89:49
|
89 | let delegators = delegators.into_iter().copied();
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
github-actions / clippy
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Vec`
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Vec`
--> node/src/transition_frontier/genesis/transition_frontier_genesis_config.rs:88:35
|
88 | let table = table.into_iter().map(|(bp_balance, delegators)| {
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
Check warning on line 81 in node/src/transaction_pool/mod.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> node/src/transaction_pool/mod.rs:81:48
|
81 | let best_tip_mask = store.service.get_mask(&best_tip_hash).unwrap(); // TODO Handle error
| ^^^^^^^^^^^^^^ help: change this to: `best_tip_hash`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 69 in node/src/transaction_pool/mod.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> node/src/transaction_pool/mod.rs:69:65
|
69 | self.pool.handle_transition_frontier_diff(diff, &accounts);
| ^^^^^^^^^ help: change this to: `accounts`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow