Skip to content

Commit

Permalink
Merge pull request #1886 from multiversx/clippy-fixes
Browse files Browse the repository at this point in the history
Clippy fixes
  • Loading branch information
alyn509 authored Nov 29, 2024
2 parents cbd9a3c + 205e434 commit dfc3b48
Show file tree
Hide file tree
Showing 41 changed files with 103 additions and 109 deletions.
2 changes: 1 addition & 1 deletion framework/base/src/hex_call_data/cd_de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl<'a> HexCallDataDeserializer<'a> {
}
}

impl<'a> TopDecodeMultiInput for HexCallDataDeserializer<'a> {
impl TopDecodeMultiInput for HexCallDataDeserializer<'_> {
type ValueInput = Box<[u8]>;

fn has_next(&self) -> bool {
Expand Down
2 changes: 0 additions & 2 deletions framework/base/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#![no_std]
#![allow(deprecated)]
#![allow(clippy::needless_lifetimes)] // TODO: fix them all!

pub use multiversx_sc_derive::{self as derive, contract, module, proxy};

// re-export basic heap types
Expand Down
2 changes: 1 addition & 1 deletion framework/base/src/storage/mappers/bi_di_mapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ where
}
}

impl<'a, SA, K, V, A> Iterator for Iter<'a, SA, K, V, A>
impl<SA, K, V, A> Iterator for Iter<'_, SA, K, V, A>
where
SA: StorageMapperApi,
A: StorageAddress<SA>,
Expand Down
2 changes: 1 addition & 1 deletion framework/base/src/storage/mappers/linked_list_mapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ where
}
}

impl<'a, SA, T, A> Iterator for Iter<'a, SA, T, A>
impl<SA, T, A> Iterator for Iter<'_, SA, T, A>
where
SA: StorageMapperApi,
A: StorageAddress<SA>,
Expand Down
10 changes: 5 additions & 5 deletions framework/base/src/storage/mappers/map_mapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ where
}
}

impl<'a, SA, A, K, V> Iterator for Iter<'a, SA, A, K, V>
impl<SA, A, K, V> Iterator for Iter<'_, SA, A, K, V>
where
SA: StorageMapperApi,
A: StorageAddress<SA>,
Expand Down Expand Up @@ -279,7 +279,7 @@ where
}
}

impl<'a, SA, A, K, V> Iterator for Values<'a, SA, A, K, V>
impl<SA, A, K, V> Iterator for Values<'_, SA, A, K, V>
where
SA: StorageMapperApi,
A: StorageAddress<SA>,
Expand Down Expand Up @@ -344,7 +344,7 @@ where
pub(super) _marker: PhantomData<&'a mut (K, V)>,
}

impl<'a, SA, A, K, V> Entry<'a, SA, A, K, V>
impl<SA, A, K, V> Entry<'_, SA, A, K, V>
where
SA: StorageMapperApi,
A: StorageAddress<SA>,
Expand Down Expand Up @@ -470,7 +470,7 @@ where
}
}

impl<'a, SA, A, K, V> OccupiedEntry<'a, SA, A, K, V>
impl<SA, A, K, V> OccupiedEntry<'_, SA, A, K, V>
where
SA: StorageMapperApi,
A: StorageAddress<SA>,
Expand All @@ -488,7 +488,7 @@ where
}
}

impl<'a, SA, K, V> OccupiedEntry<'a, SA, CurrentStorage, K, V>
impl<SA, K, V> OccupiedEntry<'_, SA, CurrentStorage, K, V>
where
SA: StorageMapperApi,
K: TopEncode + TopDecode + NestedEncode + NestedDecode + Clone,
Expand Down
10 changes: 5 additions & 5 deletions framework/base/src/storage/mappers/map_storage_mapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ where
}
}

impl<'a, SA, A, K, V> Iterator for Iter<'a, SA, A, K, V>
impl<SA, A, K, V> Iterator for Iter<'_, SA, A, K, V>
where
SA: StorageMapperApi,
A: StorageAddress<SA>,
Expand Down Expand Up @@ -268,7 +268,7 @@ where
}
}

impl<'a, SA, A, K, V> Iterator for Values<'a, SA, A, K, V>
impl<SA, A, K, V> Iterator for Values<'_, SA, A, K, V>
where
SA: StorageMapperApi,
A: StorageAddress<SA>,
Expand Down Expand Up @@ -388,7 +388,7 @@ where
}
}

impl<'a, SA, A, K, V> VacantEntry<'a, SA, A, K, V>
impl<SA, A, K, V> VacantEntry<'_, SA, A, K, V>
where
SA: StorageMapperApi,
A: StorageAddress<SA>,
Expand Down Expand Up @@ -420,7 +420,7 @@ where
}
}

impl<'a, SA, A, K, V> OccupiedEntry<'a, SA, A, K, V>
impl<SA, A, K, V> OccupiedEntry<'_, SA, A, K, V>
where
SA: StorageMapperApi,
A: StorageAddress<SA>,
Expand All @@ -438,7 +438,7 @@ where
}
}

impl<'a, SA, K, V> OccupiedEntry<'a, SA, CurrentStorage, K, V>
impl<SA, K, V> OccupiedEntry<'_, SA, CurrentStorage, K, V>
where
SA: StorageMapperApi,
K: TopEncode + TopDecode + NestedEncode + NestedDecode + Clone + 'static,
Expand Down
2 changes: 1 addition & 1 deletion framework/base/src/storage/mappers/queue_mapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ where
}
}

impl<'a, SA, A, T> Iterator for Iter<'a, SA, A, T>
impl<SA, A, T> Iterator for Iter<'_, SA, A, T>
where
SA: StorageMapperApi,
A: StorageAddress<SA>,
Expand Down
2 changes: 1 addition & 1 deletion framework/base/src/storage/mappers/unique_id_mapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ where
}
}

impl<'a, SA, A> Iterator for Iter<'a, SA, A>
impl<SA, A> Iterator for Iter<'_, SA, A>
where
SA: StorageMapperApi,
A: StorageAddress<SA>,
Expand Down
2 changes: 1 addition & 1 deletion framework/base/src/storage/mappers/vec_mapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ where
}
}

impl<'a, SA, T, A> Iterator for Iter<'a, SA, T, A>
impl<SA, T, A> Iterator for Iter<'_, SA, T, A>
where
SA: StorageMapperApi,
A: StorageAddress<SA>,
Expand Down
2 changes: 1 addition & 1 deletion framework/base/src/storage/storage_get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ where
}
}

impl<'k, A> TopDecodeInput for StorageGetInput<'k, A>
impl<A> TopDecodeInput for StorageGetInput<'_, A>
where
A: StorageReadApi + ManagedTypeApi + ErrorApi + 'static,
{
Expand Down
2 changes: 1 addition & 1 deletion framework/base/src/storage/storage_get_from_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ where
}
}

impl<'k, A> TopDecodeInput for StorageGetFromAddressInput<'k, A>
impl<A> TopDecodeInput for StorageGetFromAddressInput<'_, A>
where
A: StorageReadApi + ManagedTypeApi + ErrorApi + 'static,
{
Expand Down
2 changes: 1 addition & 1 deletion framework/base/src/storage/storage_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ where
}
}

impl<'k, A> TopEncodeOutput for StorageSetOutput<'k, A>
impl<A> TopEncodeOutput for StorageSetOutput<'_, A>
where
A: StorageWriteApi + ManagedTypeApi + ErrorApi + 'static,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ where
}
}

impl<'a, Env> AnnotatedValue<Env, BigUint<Env::Api>> for ManagedRef<'a, Env::Api, BigUint<Env::Api>>
impl<Env> AnnotatedValue<Env, BigUint<Env::Api>> for ManagedRef<'_, Env::Api, BigUint<Env::Api>>
where
Env: TxEnv,
{
Expand Down
20 changes: 10 additions & 10 deletions framework/base/src/types/interaction/expr/test_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ impl<'a> TestAddress<'a> {
}
}

impl<'a, 'b> PartialEq<TestSCAddress<'b>> for TestAddress<'a> {
impl PartialEq<TestSCAddress<'_>> for TestAddress<'_> {
fn eq(&self, other: &TestSCAddress) -> bool {
self.to_address() == other.to_address()
}
}

impl<'a> PartialEq<Address> for TestAddress<'a> {
impl PartialEq<Address> for TestAddress<'_> {
fn eq(&self, other: &Address) -> bool {
&self.to_address() == other
}
Expand All @@ -74,7 +74,7 @@ impl<'a> PartialEq<TestAddress<'a>> for Address {
}
}

impl<'a, Api: ManagedTypeApi> PartialEq<ManagedAddress<Api>> for TestAddress<'a> {
impl<Api: ManagedTypeApi> PartialEq<ManagedAddress<Api>> for TestAddress<'_> {
fn eq(&self, other: &ManagedAddress<Api>) -> bool {
self.to_address() == other.to_address()
}
Expand All @@ -86,7 +86,7 @@ impl<'a, Api: ManagedTypeApi> PartialEq<TestAddress<'a>> for ManagedAddress<Api>
}
}

impl<'a, Env> AnnotatedValue<Env, ManagedAddress<Env::Api>> for TestAddress<'a>
impl<Env> AnnotatedValue<Env, ManagedAddress<Env::Api>> for TestAddress<'_>
where
Env: TxEnv,
{
Expand All @@ -102,7 +102,7 @@ where
}
}

impl<'a, Env> TxFrom<Env> for TestAddress<'a>
impl<Env> TxFrom<Env> for TestAddress<'_>
where
Env: TxEnv,
{
Expand All @@ -111,11 +111,11 @@ where
expr.into()
}
}
impl<'a, Env> TxFromSpecified<Env> for TestAddress<'a> where Env: TxEnv {}
impl<'a, Env> TxTo<Env> for TestAddress<'a> where Env: TxEnv {}
impl<'a, Env> TxToSpecified<Env> for TestAddress<'a> where Env: TxEnv {}
impl<Env> TxFromSpecified<Env> for TestAddress<'_> where Env: TxEnv {}
impl<Env> TxTo<Env> for TestAddress<'_> where Env: TxEnv {}
impl<Env> TxToSpecified<Env> for TestAddress<'_> where Env: TxEnv {}

impl<'a> TopEncode for TestAddress<'a> {
impl TopEncode for TestAddress<'_> {
fn top_encode_or_handle_err<O, H>(&self, output: O, h: H) -> Result<(), H::HandledErr>
where
O: TopEncodeOutput,
Expand All @@ -125,7 +125,7 @@ impl<'a> TopEncode for TestAddress<'a> {
}
}

impl<'a, Api> TypeAbiFrom<TestAddress<'a>> for ManagedAddress<Api> where Api: ManagedTypeApi {}
impl<Api> TypeAbiFrom<TestAddress<'_>> for ManagedAddress<Api> where Api: ManagedTypeApi {}

#[cfg(test)]
pub mod tests {
Expand Down
24 changes: 12 additions & 12 deletions framework/base/src/types/interaction/expr/test_sc_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl<'a> TestSCAddress<'a> {
}
}

impl<'a, Env> AnnotatedValue<Env, ManagedAddress<Env::Api>> for TestSCAddress<'a>
impl<Env> AnnotatedValue<Env, ManagedAddress<Env::Api>> for TestSCAddress<'_>
where
Env: TxEnv,
{
Expand All @@ -48,7 +48,7 @@ where
}
}

impl<'a> TestSCAddress<'a> {
impl TestSCAddress<'_> {
pub fn to_address(&self) -> Address {
self.eval_to_array().into()
}
Expand All @@ -58,13 +58,13 @@ impl<'a> TestSCAddress<'a> {
}
}

impl<'a, 'b> PartialEq<TestAddress<'b>> for TestSCAddress<'a> {
impl PartialEq<TestAddress<'_>> for TestSCAddress<'_> {
fn eq(&self, other: &TestAddress) -> bool {
self.to_address() == other.to_address()
}
}

impl<'a> PartialEq<Address> for TestSCAddress<'a> {
impl PartialEq<Address> for TestSCAddress<'_> {
fn eq(&self, other: &Address) -> bool {
&self.to_address() == other
}
Expand All @@ -76,7 +76,7 @@ impl<'a> PartialEq<TestSCAddress<'a>> for Address {
}
}

impl<'a, Api: ManagedTypeApi> PartialEq<ManagedAddress<Api>> for TestSCAddress<'a> {
impl<Api: ManagedTypeApi> PartialEq<ManagedAddress<Api>> for TestSCAddress<'_> {
fn eq(&self, other: &ManagedAddress<Api>) -> bool {
self.to_address() == other.to_address()
}
Expand All @@ -88,7 +88,7 @@ impl<'a, Api: ManagedTypeApi> PartialEq<TestSCAddress<'a>> for ManagedAddress<Ap
}
}

impl<'a, Env> TxFrom<Env> for TestSCAddress<'a>
impl<Env> TxFrom<Env> for TestSCAddress<'_>
where
Env: TxEnv,
{
Expand All @@ -97,11 +97,11 @@ where
expr.into()
}
}
impl<'a, Env> TxFromSpecified<Env> for TestSCAddress<'a> where Env: TxEnv {}
impl<'a, Env> TxTo<Env> for TestSCAddress<'a> where Env: TxEnv {}
impl<'a, Env> TxToSpecified<Env> for TestSCAddress<'a> where Env: TxEnv {}
impl<Env> TxFromSpecified<Env> for TestSCAddress<'_> where Env: TxEnv {}
impl<Env> TxTo<Env> for TestSCAddress<'_> where Env: TxEnv {}
impl<Env> TxToSpecified<Env> for TestSCAddress<'_> where Env: TxEnv {}

impl<'a> TestSCAddress<'a> {
impl TestSCAddress<'_> {
pub fn eval_to_array(&self) -> [u8; 32] {
let result = *b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00______________________";
let expr_bytes = self.name.as_bytes();
Expand Down Expand Up @@ -130,7 +130,7 @@ impl<'a> TestSCAddress<'a> {
}
}

impl<'a> TopEncode for TestSCAddress<'a> {
impl TopEncode for TestSCAddress<'_> {
fn top_encode_or_handle_err<O, H>(&self, output: O, h: H) -> Result<(), H::HandledErr>
where
O: TopEncodeOutput,
Expand All @@ -140,7 +140,7 @@ impl<'a> TopEncode for TestSCAddress<'a> {
}
}

impl<'a, Api> TypeAbiFrom<TestSCAddress<'a>> for ManagedAddress<Api> where Api: ManagedTypeApi {}
impl<Api> TypeAbiFrom<TestSCAddress<'_>> for ManagedAddress<Api> where Api: ManagedTypeApi {}

#[cfg(test)]
pub mod tests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl<'a> TestTokenIdentifier<'a> {
}
}

impl<'a, Env> AnnotatedValue<Env, TokenIdentifier<Env::Api>> for TestTokenIdentifier<'a>
impl<Env> AnnotatedValue<Env, TokenIdentifier<Env::Api>> for TestTokenIdentifier<'_>
where
Env: TxEnv,
{
Expand All @@ -64,7 +64,7 @@ where
}
}

impl<'a> TopEncode for TestTokenIdentifier<'a> {
impl TopEncode for TestTokenIdentifier<'_> {
fn top_encode_or_handle_err<O, H>(&self, output: O, h: H) -> Result<(), H::HandledErr>
where
O: TopEncodeOutput,
Expand All @@ -74,5 +74,4 @@ impl<'a> TopEncode for TestTokenIdentifier<'a> {
}
}

impl<'a, Api> TypeAbiFrom<TestTokenIdentifier<'a>> for TokenIdentifier<Api> where Api: ManagedTypeApi
{}
impl<Api> TypeAbiFrom<TestTokenIdentifier<'_>> for TokenIdentifier<Api> where Api: ManagedTypeApi {}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ where
}
}

impl<'a, Env> TxPayment<Env> for TestEsdtTransfer<'a>
impl<Env> TxPayment<Env> for TestEsdtTransfer<'_>
where
Env: TxEnv,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::types::{BigUint, EgldOrEsdtTokenPaymentRefs, ManagedAddress, TxFrom,

use super::{Egld, FullPaymentData, FunctionCall, TxEnv, TxPayment};

impl<'a, Env> TxPayment<Env> for EgldOrEsdtTokenPaymentRefs<'a, Env::Api>
impl<Env> TxPayment<Env> for EgldOrEsdtTokenPaymentRefs<'_, Env::Api>
where
Env: TxEnv,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::types::{BigUint, EgldOrMultiEsdtPaymentRefs, ManagedAddress, TxFrom,

use super::{Egld, FullPaymentData, FunctionCall, TxEnv, TxPayment};

impl<'a, Env> TxPayment<Env> for EgldOrMultiEsdtPaymentRefs<'a, Env::Api>
impl<Env> TxPayment<Env> for EgldOrMultiEsdtPaymentRefs<'_, Env::Api>
where
Env: TxEnv,
{
Expand Down
Loading

0 comments on commit dfc3b48

Please sign in to comment.