Skip to content

Fix clippy warning, clean up nimiq-time crate and use it everywhere #14182

Fix clippy warning, clean up nimiq-time crate and use it everywhere

Fix clippy warning, clean up nimiq-time crate and use it everywhere #14182

GitHub Actions / Clippy Report failed Nov 28, 2024 in 1s

Clippy Report

1 error, 68 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 1
Warning 68
Note 0
Help 0

Versions

  • rustc 1.83.0 (90b35a623 2024-11-26)
  • cargo 1.83.0 (5ffbef321 2024-10-29)
  • clippy 0.1.83 (90b35a6 2024-11-26)

Annotations

Check warning on line 72 in validator/src/aggregation/tendermint/state.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'a

warning: the following explicit lifetimes could be elided: 'a
  --> validator/src/aggregation/tendermint/state.rs:72:6
   |
72 | impl<'a> Debug for Votes<'a> {
   |      ^^                  ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
   |
72 - impl<'a> Debug for Votes<'a> {
72 + impl Debug for Votes<'_> {
   |

Check warning on line 62 in validator/src/aggregation/tendermint/state.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'a

warning: the following explicit lifetimes could be elided: 'a
  --> validator/src/aggregation/tendermint/state.rs:62:6
   |
62 | impl<'a> Debug for BestVotes<'a> {
   |      ^^                      ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
   |
62 - impl<'a> Debug for BestVotes<'a> {
62 + impl Debug for BestVotes<'_> {
   |

Check warning on line 51 in validator/src/aggregation/tendermint/state.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'a

warning: the following explicit lifetimes could be elided: 'a
  --> validator/src/aggregation/tendermint/state.rs:51:6
   |
51 | impl<'a, T> Debug for DisplayWrapper<'a, T>
   |      ^^                              ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
   = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
   |
51 - impl<'a, T> Debug for DisplayWrapper<'a, T>
51 + impl<T> Debug for DisplayWrapper<'_, T>
   |

Check failure on line 148 in metrics-server/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

redundant redefinition of a binding `task_monitors`

error: redundant redefinition of a binding `task_monitors`
   --> metrics-server/src/lib.rs:148:13
    |
148 |             let task_monitors = task_monitors;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: `task_monitors` is initially defined here
   --> metrics-server/src/lib.rs:145:13
    |
145 |         let task_monitors = task_monitors.to_vec();
    |             ^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_locals
    = note: `#[deny(clippy::redundant_locals)]` on by default

Check warning on line 97 in blockchain-proxy/src/blockchain_proxy.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'a

warning: the following explicit lifetimes could be elided: 'a
  --> blockchain-proxy/src/blockchain_proxy.rs:97:6
   |
97 | impl<'a> AbstractBlockchain for BlockchainReadProxy<'a> {
   |      ^^                                             ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
   = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
   |
97 - impl<'a> AbstractBlockchain for BlockchainReadProxy<'a> {
97 + impl AbstractBlockchain for BlockchainReadProxy<'_> {
   |

Check warning on line 119 in blockchain/src/history/mmr_store.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'a, 'env

warning: the following explicit lifetimes could be elided: 'a, 'env
   --> blockchain/src/history/mmr_store.rs:119:6
    |
119 | impl<'a, 'env> Store<Blake2bHash> for MMRStore<'a, 'env> {
    |      ^^  ^^^^                                  ^^  ^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
    |
119 - impl<'a, 'env> Store<Blake2bHash> for MMRStore<'a, 'env> {
119 + impl Store<Blake2bHash> for MMRStore<'_, '_> {
    |

Check warning on line 603 in blockchain/src/history/history_store_index.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'txn

warning: the following explicit lifetimes could be elided: 'txn
   --> blockchain/src/history/history_store_index.rs:603:6
    |
603 | impl<'txn> Iterator for TxHashIterator<'txn> {
    |      ^^^^                              ^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
    |
603 - impl<'txn> Iterator for TxHashIterator<'txn> {
603 + impl Iterator for TxHashIterator<'_> {
    |

Check warning on line 23 in zkp-circuits/src/circuits/mod.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

manually reimplementing `div_ceil`

warning: manually reimplementing `div_ceil`
  --> zkp-circuits/src/circuits/mod.rs:23:23
   |
23 |         num_inputs += (num_bytes[i] * 8 + capacity - 1) / capacity;
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.div_ceil()`: `(num_bytes[i] * 8).div_ceil(capacity)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil
   = note: `#[warn(clippy::manual_div_ceil)]` on by default

Check warning on line 90 in validator-network/src/single_response_requester.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'a

warning: the following explicit lifetimes could be elided: 'a
  --> validator-network/src/single_response_requester.rs:90:6
   |
90 | impl<'a, TValidatorNetwork, TRequest, TOutput> Future
   |      ^^
91 |     for SingleResponseRequester<'a, TValidatorNetwork, TRequest, TOutput>
   |                                 ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
   |
90 ~ impl<TValidatorNetwork, TRequest, TOutput> Future
91 ~     for SingleResponseRequester<'_, TValidatorNetwork, TRequest, TOutput>
   |

Check warning on line 32 in validator-network/src/single_response_requester.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'a

warning: the following explicit lifetimes could be elided: 'a
  --> validator-network/src/single_response_requester.rs:32:6
   |
32 | impl<'a, TValidatorNetwork, TRequest, TOutput>
   |      ^^
33 |     SingleResponseRequester<'a, TValidatorNetwork, TRequest, TOutput>
   |                             ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
   = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
   |
32 ~ impl<TValidatorNetwork, TRequest, TOutput>
33 ~     SingleResponseRequester<'_, TValidatorNetwork, TRequest, TOutput>
   |

Check warning on line 49 in zkp-primitives/pedersen-generators/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

manually reimplementing `div_ceil`

warning: manually reimplementing `div_ceil`
  --> zkp-primitives/pedersen-generators/src/lib.rs:49:31
   |
49 |     let generators_needed_b = (num_bits_per_leaf + capacity - 1) / capacity + 1;
   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.div_ceil()`: `num_bits_per_leaf.div_ceil(capacity)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil
   = note: `#[warn(clippy::manual_div_ceil)]` on by default

Check warning on line 85 in primitives/account/src/data_store.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'store, 'tree, 'txn, 'txni, 'env

warning: the following explicit lifetimes could be elided: 'store, 'tree, 'txn, 'txni, 'env
  --> primitives/account/src/data_store.rs:85:6
   |
85 | impl<'store, 'tree, 'txn, 'txni, 'env> DataStoreWrite<'store, 'tree, 'txn, 'txni, 'env> {
   |      ^^^^^^  ^^^^^  ^^^^  ^^^^^  ^^^^                 ^^^^^^  ^^^^^  ^^^^  ^^^^^  ^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
   |
85 - impl<'store, 'tree, 'txn, 'txni, 'env> DataStoreWrite<'store, 'tree, 'txn, 'txni, 'env> {
85 + impl DataStoreWrite<'_, '_, '_, '_, '_> {
   |

Check warning on line 68 in primitives/account/src/data_store.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'store, 'tree, 'env

warning: the following explicit lifetimes could be elided: 'store, 'tree, 'env
  --> primitives/account/src/data_store.rs:68:6
   |
68 | impl<'store, 'tree, 'txn, 'env> DataStoreIterOps for DataStoreRead<'store, 'tree, 'txn, 'env> {
   |      ^^^^^^  ^^^^^        ^^^^                                     ^^^^^^  ^^^^^        ^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
   |
68 - impl<'store, 'tree, 'txn, 'env> DataStoreIterOps for DataStoreRead<'store, 'tree, 'txn, 'env> {
68 + impl<'txn> DataStoreIterOps for DataStoreRead<'_, '_, 'txn, '_> {
   |

Check warning on line 62 in primitives/account/src/data_store.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'store, 'tree, 'txn, 'env

warning: the following explicit lifetimes could be elided: 'store, 'tree, 'txn, 'env
  --> primitives/account/src/data_store.rs:62:6
   |
62 | impl<'store, 'tree, 'txn, 'env> DataStoreReadOps for DataStoreRead<'store, 'tree, 'txn, 'env> {
   |      ^^^^^^  ^^^^^  ^^^^  ^^^^                                     ^^^^^^  ^^^^^  ^^^^  ^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
   |
62 - impl<'store, 'tree, 'txn, 'env> DataStoreReadOps for DataStoreRead<'store, 'tree, 'txn, 'env> {
62 + impl DataStoreReadOps for DataStoreRead<'_, '_, '_, '_> {
   |

Check warning on line 131 in primitives/account/src/account/staking_contract/store.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'write, 'store, 'tree, 'txn, 'txni, 'env

warning: the following explicit lifetimes could be elided: 'write, 'store, 'tree, 'txn, 'txni, 'env
   --> primitives/account/src/account/staking_contract/store.rs:131:6
    |
131 | impl<'write, 'store, 'tree, 'txn, 'txni, 'env> StakingContractStoreReadOps
    |      ^^^^^^  ^^^^^^  ^^^^^  ^^^^  ^^^^^  ^^^^
132 |     for StakingContractStoreWrite<'write, 'store, 'tree, 'txn, 'txni, 'env>
    |                                   ^^^^^^  ^^^^^^  ^^^^^  ^^^^  ^^^^^  ^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
    |
131 ~ impl StakingContractStoreReadOps
132 ~     for StakingContractStoreWrite<'_, '_, '_, '_, '_, '_>
    |

Check warning on line 73 in primitives/account/src/account/staking_contract/store.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'read

warning: the following explicit lifetimes could be elided: 'read
  --> primitives/account/src/account/staking_contract/store.rs:73:6
   |
73 | impl<'read, T: DataStoreReadOps + DataStoreIterOps> StakingContractStoreRead<'read, T> {
   |      ^^^^^                                                                   ^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
   |
73 - impl<'read, T: DataStoreReadOps + DataStoreIterOps> StakingContractStoreRead<'read, T> {
73 + impl<T: DataStoreReadOps + DataStoreIterOps> StakingContractStoreRead<'_, T> {
   |

Check warning on line 57 in primitives/account/src/account/staking_contract/store.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'read

warning: the following explicit lifetimes could be elided: 'read
  --> primitives/account/src/account/staking_contract/store.rs:57:6
   |
57 | impl<'read, T: DataStoreReadOps> StakingContractStoreReadOps
   |      ^^^^^
58 |     for StakingContractStoreRead<'read, T>
   |                                  ^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
   = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
   |
57 ~ impl<T: DataStoreReadOps> StakingContractStoreReadOps
58 ~     for StakingContractStoreRead<'_, T>
   |

Check warning on line 1628 in primitives/trie/src/trie.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'txn

warning: the following explicit lifetimes could be elided: 'txn
    --> primitives/trie/src/trie.rs:1628:6
     |
1628 | impl<'txn, T: TrieTable, D: Deserialize> Iterator for TrieNodeIter<'txn, T, D> {
     |      ^^^^                                                          ^^^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
     |
1628 - impl<'txn, T: TrieTable, D: Deserialize> Iterator for TrieNodeIter<'txn, T, D> {
1628 + impl<T: TrieTable, D: Deserialize> Iterator for TrieNodeIter<'_, T, D> {
     |

Check warning on line 1610 in primitives/trie/src/trie.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'txn

warning: the following explicit lifetimes could be elided: 'txn
    --> primitives/trie/src/trie.rs:1610:6
     |
1610 | impl<'txn, T: TrieTable, D> TrieNodeIter<'txn, T, D> {
     |      ^^^^                                ^^^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
     |
1610 - impl<'txn, T: TrieTable, D> TrieNodeIter<'txn, T, D> {
1610 + impl<T: TrieTable, D> TrieNodeIter<'_, T, D> {
     |

Check warning on line 121 in primitives/trie/src/transaction.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'txn

warning: the following explicit lifetimes could be elided: 'txn
   --> primitives/trie/src/transaction.rs:121:6
    |
121 | impl<'txn, 'env> ops::Deref for WriteTransactionProxy<'txn, 'env> {
    |      ^^^^                                             ^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
    |
121 - impl<'txn, 'env> ops::Deref for WriteTransactionProxy<'txn, 'env> {
121 + impl<'env> ops::Deref for WriteTransactionProxy<'_, 'env> {
    |

Check warning on line 63 in primitives/trie/src/transaction.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'txn

warning: the following explicit lifetimes could be elided: 'txn
  --> primitives/trie/src/transaction.rs:63:6
   |
63 | impl<'txn, 'env> WriteTransactionProxy<'txn, 'env> {
   |      ^^^^                              ^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
   |
63 - impl<'txn, 'env> WriteTransactionProxy<'txn, 'env> {
63 + impl<'env> WriteTransactionProxy<'_, 'env> {
   |

Check warning on line 31 in primitives/trie/src/transaction.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'txn, 'env

warning: the following explicit lifetimes could be elided: 'txn, 'env
  --> primitives/trie/src/transaction.rs:31:6
   |
31 | impl<'txn, 'env> TransactionExt for WriteTransactionProxy<'txn, 'env> {
   |      ^^^^  ^^^^                                           ^^^^  ^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
   |
31 - impl<'txn, 'env> TransactionExt for WriteTransactionProxy<'txn, 'env> {
31 + impl TransactionExt for WriteTransactionProxy<'_, '_> {
   |

Check warning on line 23 in primitives/trie/src/transaction.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'db

warning: the following explicit lifetimes could be elided: 'db
  --> primitives/trie/src/transaction.rs:23:6
   |
23 | impl<'db> TransactionExt for MdbxReadTransaction<'db> {
   |      ^^^                                         ^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
   = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
   |
23 - impl<'db> TransactionExt for MdbxReadTransaction<'db> {
23 + impl TransactionExt for MdbxReadTransaction<'_> {
   |

Check warning on line 85 in primitives/account/src/data_store.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'store, 'tree, 'txn, 'txni, 'env

warning: the following explicit lifetimes could be elided: 'store, 'tree, 'txn, 'txni, 'env
  --> primitives/account/src/data_store.rs:85:6
   |
85 | impl<'store, 'tree, 'txn, 'txni, 'env> DataStoreWrite<'store, 'tree, 'txn, 'txni, 'env> {
   |      ^^^^^^  ^^^^^  ^^^^  ^^^^^  ^^^^                 ^^^^^^  ^^^^^  ^^^^  ^^^^^  ^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
   |
85 - impl<'store, 'tree, 'txn, 'txni, 'env> DataStoreWrite<'store, 'tree, 'txn, 'txni, 'env> {
85 + impl DataStoreWrite<'_, '_, '_, '_, '_> {
   |

Check warning on line 68 in primitives/account/src/data_store.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Report

the following explicit lifetimes could be elided: 'store, 'tree, 'env

warning: the following explicit lifetimes could be elided: 'store, 'tree, 'env
  --> primitives/account/src/data_store.rs:68:6
   |
68 | impl<'store, 'tree, 'txn, 'env> DataStoreIterOps for DataStoreRead<'store, 'tree, 'txn, 'env> {
   |      ^^^^^^  ^^^^^        ^^^^                                     ^^^^^^  ^^^^^        ^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
   |
68 - impl<'store, 'tree, 'txn, 'env> DataStoreIterOps for DataStoreRead<'store, 'tree, 'txn, 'env> {
68 + impl<'txn> DataStoreIterOps for DataStoreRead<'_, '_, 'txn, '_> {
   |