Skip to content

Commit

Permalink
clippy fix (rustc 1.83.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-marinica committed Nov 28, 2024
1 parent 4b320be commit 69c6974
Show file tree
Hide file tree
Showing 34 changed files with 48 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use crate::tx_mock::{BlockchainUpdate, TxCache, TxInput, TxResult};

/// Every unimplemented fn will be implemented and moved to its corresponding file.
///
/// This file will be deleted.
pub fn register_meta_esdt(tx_input: TxInput, tx_cache: TxCache) -> (TxResult, BlockchainUpdate) {
unimplemented!()
}
Expand Down
1 change: 1 addition & 0 deletions contracts/examples/crypto-kitties/common/random/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub trait Randomizeable {

impl Random {
/// block random seed + salt creates a stronger randomness source
#[allow(static_mut_refs)]
pub fn new<M: ManagedTypeApi>(
seed: ManagedByteArray<M, SEED_SIZE>,
salt: ManagedByteArray<M, SALT_SIZE>,
Expand Down
1 change: 0 additions & 1 deletion data/codec/src/impl_for_types/impl_phantom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use crate::{
/// Empty structure with an empty bytes representation. Equivalent to `false`, `0` or `[u8; 0]`, but more explicit.
///
/// Note: the unit type `()` would have naturally fit this role, but we decided to make the unit type multi-value only.
impl<T> TopEncode for PhantomData<T> {
#[inline]
fn top_encode_or_handle_err<O, H>(&self, output: O, _h: H) -> Result<(), H::HandledErr>
Expand Down
2 changes: 1 addition & 1 deletion data/codec/src/single/nested_de_input_slice.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{DecodeError, DecodeErrorHandler, NestedDecode, NestedDecodeInput};

/// A nested decode buffer implementation on referenced data.
impl<'a> NestedDecodeInput for &'a [u8] {
impl NestedDecodeInput for &[u8] {
fn remaining_len(&self) -> usize {
self.len()
}
Expand Down
1 change: 0 additions & 1 deletion data/codec/src/single/top_en_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use crate::{
use alloc::vec::Vec;

/// Specifies objects that can receive the result of a TopEncode computation.
/// in principle from NestedEncode performed on nested items.
///
/// All methods consume the object, so they can only be called once.
Expand Down
1 change: 1 addition & 0 deletions framework/base/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![no_std]
#![allow(deprecated)]
#![allow(clippy::needless_lifetimes)] // TODO: fix them all!

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

Expand Down
2 changes: 1 addition & 1 deletion framework/base/src/storage/mappers/map_mapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,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
1 change: 0 additions & 1 deletion framework/base/src/types/managed/basic/managed_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ impl<M: ManagedTypeApi> ManagedBuffer<M> {
/// ## Safety
///
/// The reference points to a shared value. Make sure the handle is not leaked.
pub unsafe fn temp_const_ref(
raw_handle: RawHandle,
) -> ManagedRef<'static, M, ManagedBuffer<M>> {
Expand Down
4 changes: 2 additions & 2 deletions framework/base/src/types/managed/wrapped/managed_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ where
}
}

impl<'a, M, T> NestedEncode for ManagedRef<'a, M, T>
impl<M, T> NestedEncode for ManagedRef<'_, M, T>
where
M: ManagedTypeApi,
T: ManagedType<M> + NestedEncode,
Expand All @@ -158,7 +158,7 @@ where
}
}

impl<'a, M, T> core::fmt::Debug for ManagedRef<'a, M, T>
impl<M, T> core::fmt::Debug for ManagedRef<'_, M, T>
where
M: ManagedTypeApi,
T: ManagedType<M> + core::fmt::Debug,
Expand Down
14 changes: 7 additions & 7 deletions framework/base/src/types/managed/wrapped/managed_ref_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ where
pub(super) handle: T::OwnHandle,
}

impl<'a, M, T> ManagedRefMut<'a, M, T>
impl<M, T> ManagedRefMut<'_, M, T>
where
M: ManagedTypeApi,
T: ManagedType<M>,
{
pub fn new(value: &'a mut T) -> Self {
pub fn new(value: &mut T) -> Self {
Self {
_phantom_m: PhantomData,
_phantom_t: PhantomData,
Expand All @@ -44,7 +44,7 @@ where
}
}

impl<'a, M, T> ManagedRefMut<'a, M, T>
impl<M, T> ManagedRefMut<'_, M, T>
where
M: ManagedTypeApi,
T: ManagedType<M> + Clone,
Expand All @@ -55,7 +55,7 @@ where
}
}

impl<'a, M, T> Clone for ManagedRefMut<'a, M, T>
impl<M, T> Clone for ManagedRefMut<'_, M, T>
where
M: ManagedTypeApi,
T: ManagedType<M>,
Expand All @@ -70,7 +70,7 @@ where
}
}

impl<'a, M, T> Deref for ManagedRefMut<'a, M, T>
impl<M, T> Deref for ManagedRefMut<'_, M, T>
where
M: ManagedTypeApi,
T: ManagedType<M>,
Expand All @@ -83,7 +83,7 @@ where
}
}

impl<'a, M, T> DerefMut for ManagedRefMut<'a, M, T>
impl<M, T> DerefMut for ManagedRefMut<'_, M, T>
where
M: ManagedTypeApi,
T: ManagedType<M>,
Expand All @@ -93,7 +93,7 @@ where
}
}

impl<'a, M, T> Borrow<T> for ManagedRefMut<'a, M, T>
impl<M, T> Borrow<T> for ManagedRefMut<'_, M, T>
where
M: ManagedTypeApi,
T: ManagedType<M>,
Expand Down
10 changes: 5 additions & 5 deletions framework/meta/src/cmd/code_report/render_code_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ impl<'a> CodeReportRender<'a> {

fn write_report_for_contract(
&mut self,
path: &String,
size: &String,
has_allocator: &String,
has_panic: &String,
path: &str,
size: &str,
has_allocator: &str,
has_panic: &str,
) {
self.writeln(format!(
"| {} | {} | {} | {} |",
path.split('/').last().unwrap_or_else(|| path),
path.split('/').last().unwrap_or(path),
size,
has_allocator,
has_panic
Expand Down
2 changes: 1 addition & 1 deletion framework/meta/src/cmd/template/template_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct TemplateSource<'a> {
pub metadata: TemplateMetadata,
}

impl<'a> TemplateSource<'a> {
impl TemplateSource<'_> {
pub fn copy_template(&self, target_path: impl AsRef<Path>, args_tag: FrameworkVersion) {
whitelisted_deep_copy(
&self.source_path,
Expand Down
6 changes: 3 additions & 3 deletions framework/scenario/src/facade/expr/file_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const FILE_PREFIX: &str = "file:";
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct FilePath<'a>(pub &'a str);

impl<'a> FilePath<'a> {
impl FilePath<'_> {
pub fn eval_to_expr(&self) -> String {
format!("{FILE_PREFIX}{}", self.0)
}
Expand All @@ -36,9 +36,9 @@ where
}
}

impl<'a, Env> TxCodeValue<Env> for FilePath<'a> where Env: ScenarioTxEnv {}
impl<Env> TxCodeValue<Env> for FilePath<'_> where Env: ScenarioTxEnv {}

impl<'a> RegisterCodeSource for FilePath<'a> {
impl RegisterCodeSource for FilePath<'_> {
fn into_code(self, env_data: ScenarioTxEnvData) -> Vec<u8> {
self.resolve_contents(&env_data.interpreter_context())
}
Expand Down
1 change: 1 addition & 0 deletions framework/scenario/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(clippy::type_complexity)]
#![allow(clippy::needless_lifetimes)] // TODO: fix them all!

pub mod api;
pub mod bech32;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ where
pub data: ScenarioTxEnvData,
}

impl<'w, GatewayProxy> TxEnv for InteractorEnvExec<'w, GatewayProxy>
impl<GatewayProxy> TxEnv for InteractorEnvExec<'_, GatewayProxy>
where
GatewayProxy: GatewayAsyncService,
{
Expand All @@ -51,7 +51,7 @@ where
}
}

impl<'w, GatewayProxy> ScenarioTxEnv for InteractorEnvExec<'w, GatewayProxy>
impl<GatewayProxy> ScenarioTxEnv for InteractorEnvExec<'_, GatewayProxy>
where
GatewayProxy: GatewayAsyncService,
{
Expand All @@ -60,7 +60,7 @@ where
}
}

impl<'w, GatewayProxy> TxEnvWithTxHash for InteractorEnvExec<'w, GatewayProxy>
impl<GatewayProxy> TxEnvWithTxHash for InteractorEnvExec<'_, GatewayProxy>
where
GatewayProxy: GatewayAsyncService,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ where
}
}

impl<'w, GatewayProxy> InteractorExecStep<'w, GatewayProxy, TransferStep, ()>
impl<GatewayProxy> InteractorExecStep<'_, GatewayProxy, TransferStep, ()>
where
GatewayProxy: GatewayAsyncService,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ where
pub data: ScenarioTxEnvData,
}

impl<'w, GatewayProxy> TxEnv for InteractorEnvQuery<'w, GatewayProxy>
impl<GatewayProxy> TxEnv for InteractorEnvQuery<'_, GatewayProxy>
where
GatewayProxy: GatewayAsyncService,
{
Expand All @@ -48,7 +48,7 @@ where
}
}

impl<'w, GatewayProxy> ScenarioTxEnv for InteractorEnvQuery<'w, GatewayProxy>
impl<GatewayProxy> ScenarioTxEnv for InteractorEnvQuery<'_, GatewayProxy>
where
GatewayProxy: GatewayAsyncService,
{
Expand Down
2 changes: 1 addition & 1 deletion framework/snippets/src/multi/interactor_step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum InteractorStepRef<'a> {
ScDeploy(&'a mut ScDeployStep),
}

impl<'a> InteractorStepRef<'a> {
impl InteractorStepRef<'_> {
pub fn to_transaction<GatewayProxy: GatewayAsyncService>(
&self,
interactor: &InteractorBase<GatewayProxy>,
Expand Down
2 changes: 2 additions & 0 deletions framework/wasm-adapter/src/api/unsafe_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ static mut BUFFER_1: [u8; BUFFER_1_SIZE] = [0u8; BUFFER_1_SIZE];
/// The second buffer is for when the first one is busy with something else.
static mut BUFFER_2: [u8; BUFFER_2_SIZE] = [0u8; BUFFER_2_SIZE];

#[allow(static_mut_refs)]
pub(crate) unsafe fn buffer_1_ptr() -> *mut u8 {
BUFFER_1.as_mut_ptr()
}

#[allow(static_mut_refs)]
pub(crate) unsafe fn buffer_2_ptr() -> *mut u8 {
BUFFER_2.as_mut_ptr()
}
2 changes: 1 addition & 1 deletion framework/wasm-adapter/src/wasm_alloc/leaking_allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ unsafe impl GlobalAlloc for LeakingAllocator {
if new_total > *size {
// Request enough new space for this allocation, even if we have some space left over from the last one incase they end up non-contiguous.
// Round up to a number of pages
let requested_pages = (requested_size + PAGE_SIZE - 1) / PAGE_SIZE;
let requested_pages = requested_size.div_ceil(PAGE_SIZE);
let previous_page_count = memory_grow(PageCount(requested_pages));

let previous_size = previous_page_count.size_in_bytes();
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/crypto/public_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl PublicKey {
}
}

impl<'a> From<&'a PrivateKey> for PublicKey {
impl From<&PrivateKey> for PublicKey {
fn from(private_key: &PrivateKey) -> PublicKey {
let bytes = private_key.to_bytes();

Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/gateway/gateway_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl<'a> GetAccountRequest<'a> {
}
}

impl<'a> GatewayRequest for GetAccountRequest<'a> {
impl GatewayRequest for GetAccountRequest<'_> {
type Payload = ();
type DecodedJson = AccountResponse;
type Result = Account;
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/gateway/gateway_account_esdt_roles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl<'a> GetAccountEsdtRolesRequest<'a> {
}
}

impl<'a> GatewayRequest for GetAccountEsdtRolesRequest<'a> {
impl GatewayRequest for GetAccountEsdtRolesRequest<'_> {
type Payload = ();
type DecodedJson = EsdtRolesResponse;
type Result = HashMap<String, Vec<String>>;
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/gateway/gateway_account_esdt_tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl<'a> GetAccountEsdtTokensRequest<'a> {
}
}

impl<'a> GatewayRequest for GetAccountEsdtTokensRequest<'a> {
impl GatewayRequest for GetAccountEsdtTokensRequest<'_> {
type Payload = ();
type DecodedJson = EsdtBalanceResponse;
type Result = HashMap<String, EsdtBalance>;
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/gateway/gateway_account_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl<'a> GetAccountStorageRequest<'a> {
}
}

impl<'a> GatewayRequest for GetAccountStorageRequest<'a> {
impl GatewayRequest for GetAccountStorageRequest<'_> {
type Payload = ();
type DecodedJson = AccountStorageResponse;
type Result = HashMap<String, String>;
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/gateway/gateway_tx_cost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use super::{GatewayRequest, GatewayRequestType, COST_TRANSACTION_ENDPOINT};
/// Note: it is a POST request.
pub struct GetTxCost<'a>(pub &'a Transaction);

impl<'a> GatewayRequest for GetTxCost<'a> {
impl GatewayRequest for GetTxCost<'_> {
type Payload = Transaction;
type DecodedJson = ResponseTxCost;
type Result = TxCostResponseData;
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/gateway/gateway_tx_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl<'a> GetTxInfo<'a> {
}
}

impl<'a> GatewayRequest for GetTxInfo<'a> {
impl GatewayRequest for GetTxInfo<'_> {
type Payload = ();
type DecodedJson = TransactionInfo;
type Result = TransactionOnNetwork;
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/gateway/gateway_tx_process_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl<'a> GetTxProcessStatus<'a> {
}
}

impl<'a> GatewayRequest for GetTxProcessStatus<'a> {
impl GatewayRequest for GetTxProcessStatus<'_> {
type Payload = ();
type DecodedJson = TransactionProcessStatus;
type Result = (String, String);
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/gateway/gateway_tx_send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use super::{GatewayRequest, GatewayRequestType, SEND_TRANSACTION_ENDPOINT};
/// Sends a single transaction.
pub struct SendTxRequest<'a>(pub &'a Transaction);

impl<'a> GatewayRequest for SendTxRequest<'a> {
impl GatewayRequest for SendTxRequest<'_> {
type Payload = Transaction;
type DecodedJson = SendTransactionResponse;
type Result = String;
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/gateway/gateway_tx_send_multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use super::{GatewayRequest, GatewayRequestType, SEND_MULTIPLE_TRANSACTIONS_ENDPO
/// Sends multiple transactions at once.
pub struct SendMultiTxRequest<'a>(pub &'a [Transaction]);

impl<'a> GatewayRequest for SendMultiTxRequest<'a> {
impl GatewayRequest for SendMultiTxRequest<'_> {
type Payload = [Transaction];
type DecodedJson = SendTransactionsResponse;
type Result = Vec<String>;
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/gateway/gateway_tx_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl<'a> GetTxStatus<'a> {
}
}

impl<'a> GatewayRequest for GetTxStatus<'a> {
impl GatewayRequest for GetTxStatus<'_> {
type Payload = ();
type DecodedJson = TransactionStatus;
type Result = String;
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/gateway/gateway_tx_vmquery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use super::{GatewayRequest, GatewayRequestType, VM_VALUES_ENDPOINT};
/// Executes a VM query.
pub struct VMQueryRequest<'a>(pub &'a VMQueryInput);

impl<'a> GatewayRequest for VMQueryRequest<'a> {
impl GatewayRequest for VMQueryRequest<'_> {
type Payload = VMQueryInput;
type DecodedJson = ResponseVmValue;
type Result = VmValuesResponseData;
Expand Down
Loading

0 comments on commit 69c6974

Please sign in to comment.