Skip to content

Commit

Permalink
Merge pull request #1853 from mintlayer/appease_clippy_1.83
Browse files Browse the repository at this point in the history
Appease clippy 1.83
  • Loading branch information
ImplOfAnImpl authored Dec 10, 2024
2 parents fb412fa + 62ad7f0 commit 41de6d3
Show file tree
Hide file tree
Showing 45 changed files with 127 additions and 134 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl<'t> ApiServerInMemoryStorageTransactionalRo<'t> {
}

#[async_trait::async_trait]
impl<'t> ApiServerTransactionRo for ApiServerInMemoryStorageTransactionalRo<'t> {
impl ApiServerTransactionRo for ApiServerInMemoryStorageTransactionalRo<'_> {
async fn close(self) -> Result<(), crate::storage::storage_api::ApiServerStorageError> {
Ok(())
}
Expand All @@ -63,7 +63,7 @@ impl<'t> ApiServerInMemoryStorageTransactionalRw<'t> {
}

#[async_trait::async_trait]
impl<'t> ApiServerTransactionRw for ApiServerInMemoryStorageTransactionalRw<'t> {
impl ApiServerTransactionRw for ApiServerInMemoryStorageTransactionalRw<'_> {
async fn commit(self) -> Result<(), crate::storage::storage_api::ApiServerStorageError> {
Ok(())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use crate::storage::storage_api::{
use super::ApiServerInMemoryStorageTransactionalRo;

#[async_trait::async_trait]
impl<'t> ApiServerStorageRead for ApiServerInMemoryStorageTransactionalRo<'t> {
impl ApiServerStorageRead for ApiServerInMemoryStorageTransactionalRo<'_> {
async fn is_initialized(&self) -> Result<bool, ApiServerStorageError> {
self.transaction.is_initialized()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use crate::storage::storage_api::{
use super::ApiServerInMemoryStorageTransactionalRw;

#[async_trait::async_trait]
impl<'t> ApiServerStorageWrite for ApiServerInMemoryStorageTransactionalRw<'t> {
impl ApiServerStorageWrite for ApiServerInMemoryStorageTransactionalRw<'_> {
async fn reinitialize_storage(
&mut self,
chain_config: &ChainConfig,
Expand Down Expand Up @@ -273,7 +273,7 @@ impl<'t> ApiServerStorageWrite for ApiServerInMemoryStorageTransactionalRw<'t> {
}

#[async_trait::async_trait]
impl<'t> ApiServerStorageRead for ApiServerInMemoryStorageTransactionalRw<'t> {
impl ApiServerStorageRead for ApiServerInMemoryStorageTransactionalRw<'_> {
async fn is_initialized(&self) -> Result<bool, ApiServerStorageError> {
self.transaction.is_initialized()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub struct ApiServerPostgresTransactionalRo<'a> {
_marker: std::marker::PhantomData<&'a ()>,
}

impl<'a> ApiServerPostgresTransactionalRo<'a> {
impl ApiServerPostgresTransactionalRo<'_> {
pub(super) async fn from_connection(
connection: PooledConnection<'static, PostgresConnectionManager<NoTls>>,
db_tx_sender: tokio::sync::mpsc::UnboundedSender<
Expand Down Expand Up @@ -160,7 +160,7 @@ pub struct ApiServerPostgresTransactionalRw<'a> {
_marker: std::marker::PhantomData<&'a ()>,
}

impl<'a> Drop for ApiServerPostgresTransactionalRw<'a> {
impl Drop for ApiServerPostgresTransactionalRw<'_> {
fn drop(&mut self) {
if !self.finished {
self.db_tx_sender
Expand All @@ -174,7 +174,7 @@ impl<'a> Drop for ApiServerPostgresTransactionalRw<'a> {
}
}

impl<'a> ApiServerPostgresTransactionalRw<'a> {
impl ApiServerPostgresTransactionalRw<'_> {
pub(super) async fn from_connection(
connection: PooledConnection<'static, PostgresConnectionManager<NoTls>>,
db_tx_sender: tokio::sync::mpsc::UnboundedSender<
Expand Down Expand Up @@ -202,7 +202,7 @@ impl<'a> ApiServerPostgresTransactionalRw<'a> {
}

#[async_trait::async_trait]
impl<'a> ApiServerTransactionRw for ApiServerPostgresTransactionalRw<'a> {
impl ApiServerTransactionRw for ApiServerPostgresTransactionalRw<'_> {
async fn commit(mut self) -> Result<(), crate::storage::storage_api::ApiServerStorageError> {
self.connection
.as_ref()
Expand All @@ -227,13 +227,13 @@ impl<'a> ApiServerTransactionRw for ApiServerPostgresTransactionalRw<'a> {
}

#[async_trait::async_trait]
impl<'a> ApiServerTransactionRo for ApiServerPostgresTransactionalRo<'a> {
impl ApiServerTransactionRo for ApiServerPostgresTransactionalRo<'_> {
async fn close(self) -> Result<(), ApiServerStorageError> {
Ok(())
}
}

impl<'a> Drop for ApiServerPostgresTransactionalRo<'a> {
impl Drop for ApiServerPostgresTransactionalRo<'_> {
fn drop(&mut self) {
if !self.finished {
self.db_tx_sender
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use pos_accounting::PoolData;
use super::{ApiServerPostgresTransactionalRo, CONN_ERR};

#[async_trait::async_trait]
impl<'a> ApiServerStorageRead for ApiServerPostgresTransactionalRo<'a> {
impl ApiServerStorageRead for ApiServerPostgresTransactionalRo<'_> {
async fn is_initialized(&self) -> Result<bool, ApiServerStorageError> {
let mut conn = QueryFromConnection::new(self.connection.as_ref().expect(CONN_ERR));
let res = conn.is_initialized().await?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use crate::storage::{
use super::{ApiServerPostgresTransactionalRw, CONN_ERR};

#[async_trait::async_trait]
impl<'a> ApiServerStorageWrite for ApiServerPostgresTransactionalRw<'a> {
impl ApiServerStorageWrite for ApiServerPostgresTransactionalRw<'_> {
async fn reinitialize_storage(
&mut self,
chain_config: &ChainConfig,
Expand Down Expand Up @@ -349,7 +349,7 @@ impl<'a> ApiServerStorageWrite for ApiServerPostgresTransactionalRw<'a> {
}

#[async_trait::async_trait]
impl<'a> ApiServerStorageRead for ApiServerPostgresTransactionalRw<'a> {
impl ApiServerStorageRead for ApiServerPostgresTransactionalRw<'_> {
async fn is_initialized(&self) -> Result<bool, ApiServerStorageError> {
let mut conn = QueryFromConnection::new(self.connection.as_ref().expect(CONN_ERR));
let res = conn.is_initialized().await?;
Expand Down
4 changes: 2 additions & 2 deletions api-server/scanner-lib/src/sync/tests/simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl<'a> PoSAccountingAdapterToCheckFees<'a> {
}
}

impl<'a> PoSAccountingView for PoSAccountingAdapterToCheckFees<'a> {
impl PoSAccountingView for PoSAccountingAdapterToCheckFees<'_> {
type Error = pos_accounting::Error;

fn pool_exists(&self, _pool_id: PoolId) -> Result<bool, Self::Error> {
Expand Down Expand Up @@ -157,7 +157,7 @@ impl<'a> OrderAccountingAdapterToCheckFees<'a> {
}
}

impl<'a> OrdersAccountingView for OrderAccountingAdapterToCheckFees<'a> {
impl OrdersAccountingView for OrderAccountingAdapterToCheckFees<'_> {
type Error = orders_accounting::Error;

fn get_order_data(
Expand Down
2 changes: 1 addition & 1 deletion api-server/web-server/src/api/json_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub enum TokenDecimals<'a> {
Single(Option<u8>),
}

impl<'a> TokenDecimals<'a> {
impl TokenDecimals<'_> {
fn get(&self, token_id: &TokenId) -> u8 {
match self {
Self::Single(decimals) => decimals.expect("must exist"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ pub trait GenBlockInfo: Clone {
fn height(&self) -> BlockHeight;
}

impl<'a, S, V> ChainstateAccessor for ChainstateRef<'a, S, V>
impl<S, V> ChainstateAccessor for ChainstateRef<'_, S, V>
where
S: BlockchainStorageRead,
V: TransactionVerificationStrategy,
Expand Down
8 changes: 4 additions & 4 deletions chainstate/src/detail/chainstateref/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ pub struct ChainstateRef<'a, S, V> {
time_getter: &'a TimeGetter,
}

impl<'a, S: BlockchainStorageRead, V: TransactionVerificationStrategy> BlockIndexHandle
for ChainstateRef<'a, S, V>
impl<S: BlockchainStorageRead, V: TransactionVerificationStrategy> BlockIndexHandle
for ChainstateRef<'_, S, V>
{
#[log_error]
fn get_block_index(
Expand Down Expand Up @@ -120,7 +120,7 @@ impl<'a, S: BlockchainStorageRead, V: TransactionVerificationStrategy> BlockInde
}
}

impl<'a, S: TransactionRw, V> ChainstateRef<'a, S, V> {
impl<S: TransactionRw, V> ChainstateRef<'_, S, V> {
#[log_error]
pub fn commit_db_tx(self) -> chainstate_storage::Result<()> {
self.db_tx.commit()
Expand Down Expand Up @@ -1117,7 +1117,7 @@ impl<'a, S: BlockchainStorageRead, V: TransactionVerificationStrategy> Chainstat
}
}

impl<'a, S: BlockchainStorageWrite, V: TransactionVerificationStrategy> ChainstateRef<'a, S, V> {
impl<S: BlockchainStorageWrite, V: TransactionVerificationStrategy> ChainstateRef<'_, S, V> {
#[log_error]
pub fn disconnect_until(
&mut self,
Expand Down
40 changes: 20 additions & 20 deletions chainstate/src/detail/chainstateref/tx_verifier_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ use tx_verifier::transaction_verifier::{CachedBlockUndo, CachedUtxosBlockUndo, T
use utils::log_error;
use utxo::{ConsumedUtxoCache, FlushableUtxoView, UtxosDB, UtxosStorageRead};

impl<'a, S: BlockchainStorageRead, V: TransactionVerificationStrategy> TransactionVerifierStorageRef
for ChainstateRef<'a, S, V>
impl<S: BlockchainStorageRead, V: TransactionVerificationStrategy> TransactionVerifierStorageRef
for ChainstateRef<'_, S, V>
{
type Error = TransactionVerifierStorageError;

Expand Down Expand Up @@ -178,8 +178,8 @@ pub fn gen_block_index_getter<S: BlockchainStorageRead>(
}
}

impl<'a, S: BlockchainStorageRead, V: TransactionVerificationStrategy> UtxosStorageRead
for ChainstateRef<'a, S, V>
impl<S: BlockchainStorageRead, V: TransactionVerificationStrategy> UtxosStorageRead
for ChainstateRef<'_, S, V>
{
type Error = storage_result::Error;

Expand All @@ -197,8 +197,8 @@ impl<'a, S: BlockchainStorageRead, V: TransactionVerificationStrategy> UtxosStor
}
}

impl<'a, S: BlockchainStorageWrite, V: TransactionVerificationStrategy> FlushableUtxoView
for ChainstateRef<'a, S, V>
impl<S: BlockchainStorageWrite, V: TransactionVerificationStrategy> FlushableUtxoView
for ChainstateRef<'_, S, V>
{
type Error = utxo::Error;

Expand All @@ -209,8 +209,8 @@ impl<'a, S: BlockchainStorageWrite, V: TransactionVerificationStrategy> Flushabl
}
}

impl<'a, S: BlockchainStorageWrite, V: TransactionVerificationStrategy>
TransactionVerifierStorageMut for ChainstateRef<'a, S, V>
impl<S: BlockchainStorageWrite, V: TransactionVerificationStrategy> TransactionVerifierStorageMut
for ChainstateRef<'_, S, V>
{
#[log_error]
fn set_token_aux_data(
Expand Down Expand Up @@ -449,8 +449,8 @@ impl<'a, S: BlockchainStorageWrite, V: TransactionVerificationStrategy>
}
}

impl<'a, S: BlockchainStorageRead, V: TransactionVerificationStrategy>
PoSAccountingStorageRead<TipStorageTag> for ChainstateRef<'a, S, V>
impl<S: BlockchainStorageRead, V: TransactionVerificationStrategy>
PoSAccountingStorageRead<TipStorageTag> for ChainstateRef<'_, S, V>
{
type Error = storage_result::Error;

Expand Down Expand Up @@ -510,8 +510,8 @@ impl<'a, S: BlockchainStorageRead, V: TransactionVerificationStrategy>
}
}

impl<'a, S: BlockchainStorageWrite, V: TransactionVerificationStrategy> FlushablePoSAccountingView
for ChainstateRef<'a, S, V>
impl<S: BlockchainStorageWrite, V: TransactionVerificationStrategy> FlushablePoSAccountingView
for ChainstateRef<'_, S, V>
{
type Error = pos_accounting::Error;

Expand All @@ -525,8 +525,8 @@ impl<'a, S: BlockchainStorageWrite, V: TransactionVerificationStrategy> Flushabl
}
}

impl<'a, S: BlockchainStorageRead, V: TransactionVerificationStrategy> TokensAccountingStorageRead
for ChainstateRef<'a, S, V>
impl<S: BlockchainStorageRead, V: TransactionVerificationStrategy> TokensAccountingStorageRead
for ChainstateRef<'_, S, V>
{
type Error = storage_result::Error;

Expand All @@ -547,8 +547,8 @@ impl<'a, S: BlockchainStorageRead, V: TransactionVerificationStrategy> TokensAcc
}
}

impl<'a, S: BlockchainStorageWrite, V: TransactionVerificationStrategy>
FlushableTokensAccountingView for ChainstateRef<'a, S, V>
impl<S: BlockchainStorageWrite, V: TransactionVerificationStrategy> FlushableTokensAccountingView
for ChainstateRef<'_, S, V>
{
type Error = tokens_accounting::Error;

Expand All @@ -562,8 +562,8 @@ impl<'a, S: BlockchainStorageWrite, V: TransactionVerificationStrategy>
}
}

impl<'a, S: BlockchainStorageRead, V: TransactionVerificationStrategy> OrdersAccountingStorageRead
for ChainstateRef<'a, S, V>
impl<S: BlockchainStorageRead, V: TransactionVerificationStrategy> OrdersAccountingStorageRead
for ChainstateRef<'_, S, V>
{
type Error = storage_result::Error;

Expand All @@ -583,8 +583,8 @@ impl<'a, S: BlockchainStorageRead, V: TransactionVerificationStrategy> OrdersAcc
}
}

impl<'a, S: BlockchainStorageWrite, V: TransactionVerificationStrategy>
FlushableOrdersAccountingView for ChainstateRef<'a, S, V>
impl<S: BlockchainStorageWrite, V: TransactionVerificationStrategy> FlushableOrdersAccountingView
for ChainstateRef<'_, S, V>
{
type Error = orders_accounting::Error;

Expand Down
4 changes: 3 additions & 1 deletion chainstate/src/detail/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ impl<S: BlockchainStorage, V: TransactionVerificationStrategy> Chainstate<S, V>
}

#[log_error]
fn make_db_tx<'a>(&'a mut self) -> chainstate_storage::Result<ChainstateRef<TxRw<'a, S>, V>> {
fn make_db_tx<'a>(
&'a mut self,
) -> chainstate_storage::Result<ChainstateRef<'a, TxRw<'a, S>, V>> {
// Note: this is a workaround for log_error's compilation issues, see log_error docs
// for details.
let this = self;
Expand Down
2 changes: 1 addition & 1 deletion chainstate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub enum ChainstateEvent {
/// shortened form.
pub struct ChainstateEventTracingWrapper<'a>(pub &'a ChainstateEvent);

impl<'a> std::fmt::Display for ChainstateEventTracingWrapper<'a> {
impl std::fmt::Display for ChainstateEventTracingWrapper<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.0 {
ChainstateEvent::NewTip(id, height) => {
Expand Down
6 changes: 3 additions & 3 deletions chainstate/storage/src/internal/store_tx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub struct StoreTxRw<'st, B: storage::Backend> {
db_tx: crate::Result<storage::TransactionRw<'st, B, Schema>>,
}

impl<'st, B: storage::Backend> StoreTxRo<'st, B> {
impl<B: storage::Backend> StoreTxRo<'_, B> {
// Read a value from the database and decode it
fn read<DbMap, I, K>(&self, key: K) -> crate::Result<Option<DbMap::Value>>
where
Expand Down Expand Up @@ -208,13 +208,13 @@ impl<'st, B: storage::Backend> StoreTxRw<'st, B> {
}
}

impl<'st, B: storage::Backend> crate::TransactionRo for StoreTxRo<'st, B> {
impl<B: storage::Backend> crate::TransactionRo for StoreTxRo<'_, B> {
fn close(self) {
self.0.close()
}
}

impl<'st, B: storage::Backend> crate::TransactionRw for StoreTxRw<'st, B> {
impl<B: storage::Backend> crate::TransactionRw for StoreTxRw<'_, B> {
fn commit(self) -> crate::Result<()> {
Ok(self.db_tx?.commit()?)
}
Expand Down
Loading

0 comments on commit 41de6d3

Please sign in to comment.