Skip to content

Commit 318efb5

Browse files
authored
Merge pull request #1964 from mintlayer/fix_rust_1_89_warnings
Fix rust/clippy 1.89 warnings
2 parents 2a34377 + b788b8c commit 318efb5

File tree

57 files changed

+94
-98
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+94
-98
lines changed

api-server/api-server-common/src/storage/impls/postgres/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl TransactionalApiServerPostgresStorage {
116116

117117
pub async fn begin_ro_transaction(
118118
&self,
119-
) -> Result<ApiServerPostgresTransactionalRo, ApiServerStorageError> {
119+
) -> Result<ApiServerPostgresTransactionalRo<'_>, ApiServerStorageError> {
120120
let conn = self
121121
.pool
122122
.get_owned()
@@ -132,7 +132,7 @@ impl TransactionalApiServerPostgresStorage {
132132

133133
pub async fn begin_rw_transaction(
134134
&self,
135-
) -> Result<ApiServerPostgresTransactionalRw, ApiServerStorageError> {
135+
) -> Result<ApiServerPostgresTransactionalRw<'_>, ApiServerStorageError> {
136136
let conn = self
137137
.pool
138138
.get_owned()

api-server/stack-test-suite/tests/v2/nft.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,12 @@ async fn ok(#[case] seed: Seed) {
100100
0,
101101
);
102102

103-
let token_id =
104-
make_token_id(&chain_config, tf.next_block_height(), &[input.clone()]).unwrap();
103+
let token_id = make_token_id(
104+
&chain_config,
105+
tf.next_block_height(),
106+
std::slice::from_ref(&input),
107+
)
108+
.unwrap();
105109

106110
// issue NFT
107111
let issue_nft_tx = TransactionBuilder::new()

blockprod/src/detail/timestamp_searcher/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ mod collect_search_data {
483483
amount_to_delegate
484484
}
485485

486-
fn make_block_builder(tf: &mut TestFramework) -> PoSBlockBuilder {
486+
fn make_block_builder(tf: &mut TestFramework) -> PoSBlockBuilder<'_> {
487487
tf.make_pos_block_builder().with_specific_staking_pool(&H256::zero().into())
488488
}
489489
}

chainstate/src/detail/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl<S: BlockchainStorage, V: TransactionVerificationStrategy> Chainstate<S, V>
140140
#[log_error]
141141
pub(crate) fn make_db_tx_ro(
142142
&self,
143-
) -> chainstate_storage::Result<ChainstateRef<TxRo<'_, S>, V>> {
143+
) -> chainstate_storage::Result<ChainstateRef<'_, TxRo<'_, S>, V>> {
144144
let db_tx = self.chainstate_storage.transaction_ro()?;
145145
Ok(chainstateref::ChainstateRef::new_ro(
146146
&self.chain_config,
@@ -152,7 +152,7 @@ impl<S: BlockchainStorage, V: TransactionVerificationStrategy> Chainstate<S, V>
152152
}
153153

154154
#[log_error]
155-
pub fn query(&self) -> Result<ChainstateQuery<TxRo<'_, S>, V>, PropertyQueryError> {
155+
pub fn query(&self) -> Result<ChainstateQuery<'_, TxRo<'_, S>, V>, PropertyQueryError> {
156156
self.make_db_tx_ro().map(ChainstateQuery::new).map_err(PropertyQueryError::from)
157157
}
158158

chainstate/storage/src/internal/store_tx/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl<'st, B: storage::Backend> StoreTxRw<'st, B> {
129129
// Get a key-value map
130130
fn get_map<DbMap, I>(
131131
&self,
132-
) -> crate::Result<storage::MapRef<storage::TransactionRw<'st, B, Schema>, DbMap>>
132+
) -> crate::Result<storage::MapRef<'_, storage::TransactionRw<'st, B, Schema>, DbMap>>
133133
where
134134
DbMap: schema::DbMap,
135135
Schema: schema::HasDbMap<DbMap, I>,

chainstate/test-framework/src/framework.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ impl TestFramework {
9898
}
9999

100100
/// Returns a block builder instance that can be used for block construction and processing.
101-
pub fn make_block_builder(&mut self) -> BlockBuilder {
101+
pub fn make_block_builder(&mut self) -> BlockBuilder<'_> {
102102
BlockBuilder::new(self)
103103
}
104104

105-
pub fn make_pos_block_builder(&mut self) -> PoSBlockBuilder {
105+
pub fn make_pos_block_builder(&mut self) -> PoSBlockBuilder<'_> {
106106
PoSBlockBuilder::new(self)
107107
}
108108

chainstate/test-suite/src/tests/fungible_tokens_v1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2915,7 +2915,7 @@ fn issue_and_mint_same_tx(#[case] seed: Seed) {
29152915
let token_id = make_token_id(
29162916
tf.chain_config().as_ref(),
29172917
tf.next_block_height(),
2918-
&[first_tx_input.clone()],
2918+
std::slice::from_ref(&first_tx_input),
29192919
)
29202920
.unwrap();
29212921

chainstate/test-suite/src/tests/orders_tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,7 +1786,7 @@ fn create_order_with_nft(#[case] seed: Seed, #[case] version: OrdersVersion) {
17861786
let token_id = make_token_id(
17871787
tf.chain_config(),
17881788
tf.next_block_height(),
1789-
&[genesis_input.clone()],
1789+
std::slice::from_ref(&genesis_input),
17901790
)
17911791
.unwrap();
17921792
let nft_issuance = random_nft_issuance(tf.chain_config(), &mut rng);
@@ -1949,7 +1949,7 @@ fn partially_fill_order_with_nft_v0(#[case] seed: Seed) {
19491949
let token_id = make_token_id(
19501950
tf.chain_config(),
19511951
tf.next_block_height(),
1952-
&[genesis_input.clone()],
1952+
std::slice::from_ref(&genesis_input),
19531953
)
19541954
.unwrap();
19551955
let nft_issuance = random_nft_issuance(tf.chain_config(), &mut rng);
@@ -2158,7 +2158,7 @@ fn partially_fill_order_with_nft_v1(#[case] seed: Seed) {
21582158
let token_id = make_token_id(
21592159
tf.chain_config(),
21602160
tf.next_block_height(),
2161-
&[genesis_input.clone()],
2161+
std::slice::from_ref(&genesis_input),
21622162
)
21632163
.unwrap();
21642164
let nft_issuance = random_nft_issuance(tf.chain_config(), &mut rng);

chainstate/tx-verifier/src/transaction_verifier/input_check/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ impl<'a> PerInputData<'a> {
222222
}
223223

224224
impl mintscript::translate::InputInfoProvider for PerInputData<'_> {
225-
fn input_info(&self) -> &InputInfo {
225+
fn input_info(&self) -> &InputInfo<'_> {
226226
&self.input
227227
}
228228

@@ -260,7 +260,7 @@ impl<'a, AV, TV, OV> TranslationContextFull<'a, AV, TV, OV> {
260260
impl<AV, TV, OV> mintscript::translate::InputInfoProvider
261261
for TranslationContextFull<'_, AV, TV, OV>
262262
{
263-
fn input_info(&self) -> &InputInfo {
263+
fn input_info(&self) -> &InputInfo<'_> {
264264
self.input.input_info()
265265
}
266266

@@ -362,11 +362,11 @@ impl<'a> CoreContext<'a> {
362362
Ok(Self { inputs_and_sigs })
363363
}
364364

365-
fn input_data(&self, n: usize) -> &PerInputData {
365+
fn input_data(&self, n: usize) -> &PerInputData<'_> {
366366
&self.inputs_and_sigs[n]
367367
}
368368

369-
fn inputs_iter(&self) -> impl ExactSizeIterator<Item = (usize, &PerInputData)> {
369+
fn inputs_iter(&self) -> impl ExactSizeIterator<Item = (usize, &PerInputData<'_>)> {
370370
self.inputs_and_sigs.iter().enumerate()
371371
}
372372
}
@@ -479,7 +479,7 @@ impl<'a, S> InputVerifyContextTimelock<'a, S> {
479479
Self { ctx, input_num }
480480
}
481481

482-
fn info(&self) -> &InputInfo {
482+
fn info(&self) -> &InputInfo<'_> {
483483
self.ctx.core_ctx.input_data(self.input_num).input_info()
484484
}
485485
}
@@ -612,7 +612,7 @@ impl<T: Transactable, S> SignatureContext for InputVerifyContextFull<'_, T, S> {
612612
self.ctx.transaction
613613
}
614614

615-
fn input_commitments(&self) -> &[SighashInputCommitment] {
615+
fn input_commitments(&self) -> &[SighashInputCommitment<'_>] {
616616
&self.ctx.input_commitments
617617
}
618618

chainstate/tx-verifier/src/transaction_verifier/input_check/signature_only_check.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl<T: Transactable> SignatureContext for InputVerifyContextSignature<'_, T> {
5050
self.tx
5151
}
5252

53-
fn input_commitments(&self) -> &[SighashInputCommitment] {
53+
fn input_commitments(&self) -> &[SighashInputCommitment<'_>] {
5454
self.input_commitments
5555
}
5656

@@ -92,7 +92,7 @@ impl<T: Transactable> mintscript::translate::SignatureInfoProvider
9292
}
9393

9494
impl<T: Transactable> InputInfoProvider for InputVerifyContextSignature<'_, T> {
95-
fn input_info(&self) -> &InputInfo {
95+
fn input_info(&self) -> &InputInfo<'_> {
9696
self.input_data.input_info()
9797
}
9898

0 commit comments

Comments
 (0)