diff --git a/cumulus/parachain-template/node/src/rpc.rs b/cumulus/parachain-template/node/src/rpc.rs index ed4003ed6d20..bb52b974f0ce 100644 --- a/cumulus/parachain-template/node/src/rpc.rs +++ b/cumulus/parachain-template/node/src/rpc.rs @@ -9,7 +9,7 @@ use std::sync::Arc; use parachain_template_runtime::{opaque::Block, AccountId, Balance, Nonce}; -pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor}; +pub use sc_rpc::DenyUnsafe; use sc_transaction_pool_api::TransactionPool; use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder; diff --git a/cumulus/parachain-template/runtime/src/weights/mod.rs b/cumulus/parachain-template/runtime/src/weights/mod.rs index 30fa2c406068..b473d49e20e6 100644 --- a/cumulus/parachain-template/runtime/src/weights/mod.rs +++ b/cumulus/parachain-template/runtime/src/weights/mod.rs @@ -24,5 +24,4 @@ pub mod rocksdb_weights; pub use block_weights::constants::BlockExecutionWeight; pub use extrinsic_weights::constants::ExtrinsicBaseWeight; -pub use paritydb_weights::constants::ParityDbWeight; pub use rocksdb_weights::constants::RocksDbWeight; diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/mod.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/mod.rs index aa994a7608a2..fa9e86102c61 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/mod.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/mod.rs @@ -42,5 +42,4 @@ pub mod xcm; pub use block_weights::constants::BlockExecutionWeight; pub use extrinsic_weights::constants::ExtrinsicBaseWeight; -pub use paritydb_weights::constants::ParityDbWeight; pub use rocksdb_weights::constants::RocksDbWeight; diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/mod.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/mod.rs index 2462138b04ac..2f1fcfb05f39 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/mod.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/mod.rs @@ -41,5 +41,4 @@ pub mod xcm; pub use block_weights::constants::BlockExecutionWeight; pub use extrinsic_weights::constants::ExtrinsicBaseWeight; -pub use paritydb_weights::constants::ParityDbWeight; pub use rocksdb_weights::constants::RocksDbWeight; diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs index 69461be38ed2..41e7ac541631 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs @@ -44,7 +44,6 @@ pub mod xcm; pub use block_weights::constants::BlockExecutionWeight; pub use extrinsic_weights::constants::ExtrinsicBaseWeight; -pub use paritydb_weights::constants::ParityDbWeight; pub use rocksdb_weights::constants::RocksDbWeight; use crate::Runtime; diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/mod.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/mod.rs index ee49c72ea5ff..a65ee31d3e55 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/mod.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/mod.rs @@ -43,7 +43,6 @@ pub mod xcm; pub use block_weights::constants::BlockExecutionWeight; pub use extrinsic_weights::constants::ExtrinsicBaseWeight; -pub use paritydb_weights::constants::ParityDbWeight; pub use rocksdb_weights::constants::RocksDbWeight; use crate::Runtime; diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/mod.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/mod.rs index 77f76342a2ed..a9a298e547ed 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/mod.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/mod.rs @@ -47,5 +47,4 @@ pub mod rocksdb_weights; pub use block_weights::constants::BlockExecutionWeight; pub use extrinsic_weights::constants::ExtrinsicBaseWeight; -pub use paritydb_weights::constants::ParityDbWeight; pub use rocksdb_weights::constants::RocksDbWeight; diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs index 6c100deaa9e4..94f2d34b265a 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs @@ -26,7 +26,7 @@ use pallet_contracts::{ }; use sp_runtime::Perbill; -pub use parachains_common::{rococo::currency::deposit, AVERAGE_ON_INITIALIZE_RATIO}; +pub use parachains_common::rococo::currency::deposit; // Prints debug output of the `contracts` pallet to stdout if the node is // started with `-lruntime::contracts=debug`. diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/mod.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/mod.rs index 30fa2c406068..b473d49e20e6 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/mod.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/mod.rs @@ -24,5 +24,4 @@ pub mod rocksdb_weights; pub use block_weights::constants::BlockExecutionWeight; pub use extrinsic_weights::constants::ExtrinsicBaseWeight; -pub use paritydb_weights::constants::ParityDbWeight; pub use rocksdb_weights::constants::RocksDbWeight; diff --git a/cumulus/parachains/runtimes/testing/penpal/src/weights/mod.rs b/cumulus/parachains/runtimes/testing/penpal/src/weights/mod.rs index 30fa2c406068..b473d49e20e6 100644 --- a/cumulus/parachains/runtimes/testing/penpal/src/weights/mod.rs +++ b/cumulus/parachains/runtimes/testing/penpal/src/weights/mod.rs @@ -24,5 +24,4 @@ pub mod rocksdb_weights; pub use block_weights::constants::BlockExecutionWeight; pub use extrinsic_weights::constants::ExtrinsicBaseWeight; -pub use paritydb_weights::constants::ParityDbWeight; pub use rocksdb_weights::constants::RocksDbWeight; diff --git a/cumulus/polkadot-parachain/src/rpc.rs b/cumulus/polkadot-parachain/src/rpc.rs index d106c52a3642..caee14e55522 100644 --- a/cumulus/polkadot-parachain/src/rpc.rs +++ b/cumulus/polkadot-parachain/src/rpc.rs @@ -22,7 +22,7 @@ use std::sync::Arc; use parachains_common::{AccountId, Balance, Block, Nonce}; use sc_client_api::AuxStore; -pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor}; +pub use sc_rpc::DenyUnsafe; use sc_transaction_pool_api::TransactionPool; use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder; diff --git a/cumulus/polkadot-parachain/src/service.rs b/cumulus/polkadot-parachain/src/service.rs index 6280d86e9f9f..1eb19a5fb270 100644 --- a/cumulus/polkadot-parachain/src/service.rs +++ b/cumulus/polkadot-parachain/src/service.rs @@ -41,7 +41,7 @@ use sp_core::Pair; use jsonrpsee::RpcModule; use crate::{fake_runtime_api::aura::RuntimeApi, rpc}; -pub use parachains_common::{AccountId, Balance, Block, BlockNumber, Hash, Header, Nonce}; +pub use parachains_common::{AccountId, Balance, Block, Hash, Header, Nonce}; use cumulus_client_consensus_relay_chain::Verifier as RelayChainVerifier; use futures::{lock::Mutex, prelude::*}; diff --git a/cumulus/primitives/parachain-inherent/src/lib.rs b/cumulus/primitives/parachain-inherent/src/lib.rs index 08407023bb46..f98c748e82fa 100644 --- a/cumulus/primitives/parachain-inherent/src/lib.rs +++ b/cumulus/primitives/parachain-inherent/src/lib.rs @@ -39,8 +39,6 @@ use sp_std::{collections::btree_map::BTreeMap, vec::Vec}; #[cfg(feature = "std")] mod client_side; #[cfg(feature = "std")] -pub use client_side::*; -#[cfg(feature = "std")] mod mock; #[cfg(feature = "std")] pub use mock::{MockValidationDataInherentDataProvider, MockXcmConfig}; diff --git a/polkadot/node/malus/src/interceptor.rs b/polkadot/node/malus/src/interceptor.rs index 04ee0905deeb..e994319beb96 100644 --- a/polkadot/node/malus/src/interceptor.rs +++ b/polkadot/node/malus/src/interceptor.rs @@ -21,7 +21,7 @@ //! messages on the overseer level. use polkadot_node_subsystem::*; -pub use polkadot_node_subsystem::{messages, messages::*, overseer, FromOrchestra}; +pub use polkadot_node_subsystem::{messages::*, overseer, FromOrchestra}; use std::{future::Future, pin::Pin}; /// Filter incoming and outgoing messages. diff --git a/polkadot/node/network/bridge/src/rx/mod.rs b/polkadot/node/network/bridge/src/rx/mod.rs index 49d81aea76af..11ac73259e3a 100644 --- a/polkadot/node/network/bridge/src/rx/mod.rs +++ b/polkadot/node/network/bridge/src/rx/mod.rs @@ -53,11 +53,6 @@ use polkadot_node_subsystem::{ use polkadot_primitives::{AuthorityDiscoveryId, BlockNumber, Hash, ValidatorIndex}; -/// Peer set info for network initialization. -/// -/// To be passed to [`FullNetworkConfiguration::add_notification_protocol`](). -pub use polkadot_node_network_protocol::peer_set::{peer_sets_info, IsAuthority}; - use std::{ collections::{hash_map, HashMap}, iter::ExactSizeIterator, diff --git a/polkadot/node/network/bridge/src/tx/mod.rs b/polkadot/node/network/bridge/src/tx/mod.rs index 22802608e1d5..d5be6f01c337 100644 --- a/polkadot/node/network/bridge/src/tx/mod.rs +++ b/polkadot/node/network/bridge/src/tx/mod.rs @@ -27,10 +27,6 @@ use polkadot_node_subsystem::{ overseer, FromOrchestra, OverseerSignal, SpawnedSubsystem, }; -/// Peer set info for network initialization. -/// -/// To be passed to [`FullNetworkConfiguration::add_notification_protocol`](). -pub use polkadot_node_network_protocol::peer_set::{peer_sets_info, IsAuthority}; use polkadot_node_network_protocol::request_response::Requests; use sc_network::{MessageSink, ReputationChange}; diff --git a/polkadot/node/service/src/parachains_db/mod.rs b/polkadot/node/service/src/parachains_db/mod.rs index 92f3f167f22f..59af30dceeb9 100644 --- a/polkadot/node/service/src/parachains_db/mod.rs +++ b/polkadot/node/service/src/parachains_db/mod.rs @@ -43,10 +43,7 @@ pub(crate) mod columns { // Version 4 only changed structures in approval voting, so we can re-export the v4 definitions. pub mod v3 { - pub use super::v4::{ - COL_APPROVAL_DATA, COL_AVAILABILITY_DATA, COL_AVAILABILITY_META, - COL_CHAIN_SELECTION_DATA, COL_DISPUTE_COORDINATOR_DATA, NUM_COLUMNS, ORDERED_COL, - }; + pub use super::v4::{NUM_COLUMNS, ORDERED_COL}; } pub mod v4 { diff --git a/polkadot/node/tracking-allocator/src/lib.rs b/polkadot/node/tracking-allocator/src/lib.rs index ab8597b5c382..33f110ce7119 100644 --- a/polkadot/node/tracking-allocator/src/lib.rs +++ b/polkadot/node/tracking-allocator/src/lib.rs @@ -226,7 +226,7 @@ unsafe impl GlobalAlloc for TrackingAllocator { } #[inline] - unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) -> () { + unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { let guard = ALLOCATOR_DATA.lock(); TrackingAllocatorData::track_and_check_limits(guard, -(layout.size() as isize)); self.0.dealloc(ptr, layout) diff --git a/polkadot/runtime/common/src/claims.rs b/polkadot/runtime/common/src/claims.rs index e05c0fe5c4c1..d15e04a660f7 100644 --- a/polkadot/runtime/common/src/claims.rs +++ b/polkadot/runtime/common/src/claims.rs @@ -561,7 +561,7 @@ impl Pallet { } // We first need to deposit the balance to ensure that the account exists. - CurrencyOf::::deposit_creating(&dest, balance_due); + let _ = CurrencyOf::::deposit_creating(&dest, balance_due); // Check if this claim should have a vesting schedule. if let Some(vs) = vesting { diff --git a/polkadot/runtime/parachains/src/assigner_on_demand/mod.rs b/polkadot/runtime/parachains/src/assigner_on_demand/mod.rs index 75c29bd6fbe4..f4214027a6bd 100644 --- a/polkadot/runtime/parachains/src/assigner_on_demand/mod.rs +++ b/polkadot/runtime/parachains/src/assigner_on_demand/mod.rs @@ -337,7 +337,12 @@ where ensure!(spot_price.le(&max_amount), Error::::SpotPriceHigherThanMaxAmount); // Charge the sending account the spot price - T::Currency::withdraw(&sender, spot_price, WithdrawReasons::FEE, existence_requirement)?; + let _ = T::Currency::withdraw( + &sender, + spot_price, + WithdrawReasons::FEE, + existence_requirement, + )?; let assignment = Assignment::new(para_id); diff --git a/polkadot/xcm/pallet-xcm/src/mock.rs b/polkadot/xcm/pallet-xcm/src/mock.rs index bc9a3c3c35a4..0ac4205ed949 100644 --- a/polkadot/xcm/pallet-xcm/src/mock.rs +++ b/polkadot/xcm/pallet-xcm/src/mock.rs @@ -28,9 +28,7 @@ use polkadot_parachain_primitives::primitives::Id as ParaId; use polkadot_runtime_parachains::origin; use sp_core::H256; use sp_runtime::{traits::IdentityLookup, AccountId32, BuildStorage}; -pub use sp_std::{ - cell::RefCell, collections::btree_map::BTreeMap, fmt::Debug, marker::PhantomData, -}; +pub use sp_std::cell::RefCell; use xcm::prelude::*; #[allow(deprecated)] use xcm_builder::CurrencyAdapter as XcmCurrencyAdapter; diff --git a/polkadot/xcm/procedural/src/builder_pattern.rs b/polkadot/xcm/procedural/src/builder_pattern.rs index 1cb795ea9b20..e58c51103497 100644 --- a/polkadot/xcm/procedural/src/builder_pattern.rs +++ b/polkadot/xcm/procedural/src/builder_pattern.rs @@ -87,8 +87,8 @@ fn generate_builder_raw_impl(name: &Ident, data_enum: &DataEnum) -> TokenStream2 let methods = data_enum.variants.iter().map(|variant| { let variant_name = &variant.ident; let method_name_string = &variant_name.to_string().to_snake_case(); - let method_name = syn::Ident::new(&method_name_string, variant_name.span()); - let docs = get_doc_comments(&variant); + let method_name = syn::Ident::new(method_name_string, variant_name.span()); + let docs = get_doc_comments(variant); let method = match &variant.fields { Fields::Unit => { quote! { @@ -148,9 +148,7 @@ fn generate_builder_impl(name: &Ident, data_enum: &DataEnum) -> Result { - return list.path.is_ident("builder"); - }, + Meta::List(ref list) => list.path.is_ident("builder"), _ => false, }); let builder_attr = match maybe_builder_attr { @@ -159,7 +157,7 @@ fn generate_builder_impl(name: &Ident, data_enum: &DataEnum) -> Result Result { let arg_names: Vec<_> = fields @@ -217,7 +215,7 @@ fn generate_builder_impl(name: &Ident, data_enum: &DataEnum) -> Result return Err(Error::new_spanned( - &variant, + variant, "Instructions that load the holding register should take operands", )), }; @@ -235,14 +233,14 @@ fn generate_builder_impl(name: &Ident, data_enum: &DataEnum) -> Result { let arg_names: Vec<_> = @@ -263,7 +261,7 @@ fn generate_builder_impl(name: &Ident, data_enum: &DataEnum) -> Result return Err(Error::new_spanned( - &variant, + variant, "BuyExecution should have named fields", )), }; @@ -289,19 +287,19 @@ fn generate_builder_unpaid_impl(name: &Ident, data_enum: &DataEnum) -> Result fields, _ => return Err(Error::new_spanned( - &unpaid_execution_variant, + unpaid_execution_variant, "UnpaidExecution should have named fields", )), }; diff --git a/polkadot/xcm/xcm-builder/src/currency_adapter.rs b/polkadot/xcm/xcm-builder/src/currency_adapter.rs index c3842a498adf..68ca0111174f 100644 --- a/polkadot/xcm/xcm-builder/src/currency_adapter.rs +++ b/polkadot/xcm/xcm-builder/src/currency_adapter.rs @@ -116,7 +116,7 @@ impl< .map_err(|_| XcmError::NotWithdrawable) } fn accrue_checked(checked_account: AccountId, amount: Currency::Balance) { - Currency::deposit_creating(&checked_account, amount); + let _ = Currency::deposit_creating(&checked_account, amount); Currency::deactivate(amount); } fn reduce_checked(checked_account: AccountId, amount: Currency::Balance) { @@ -218,7 +218,7 @@ impl< let amount = Matcher::matches_fungible(what).ok_or(Error::AssetNotHandled)?; let who = AccountIdConverter::convert_location(who).ok_or(Error::AccountIdConversionFailed)?; - Currency::withdraw(&who, amount, WithdrawReasons::TRANSFER, AllowDeath) + let _ = Currency::withdraw(&who, amount, WithdrawReasons::TRANSFER, AllowDeath) .map_err(|e| XcmError::FailedToTransactAsset(e.into()))?; Ok(what.clone().into()) } diff --git a/polkadot/xcm/xcm-builder/src/tests/mock.rs b/polkadot/xcm/xcm-builder/src/tests/mock.rs index 189274eb5f5b..843c39bbfeb5 100644 --- a/polkadot/xcm/xcm-builder/src/tests/mock.rs +++ b/polkadot/xcm/xcm-builder/src/tests/mock.rs @@ -27,20 +27,16 @@ pub use crate::{ }; use frame_support::traits::{ContainsPair, Everything}; pub use frame_support::{ - dispatch::{ - DispatchInfo, DispatchResultWithPostInfo, GetDispatchInfo, Parameter, PostDispatchInfo, - }, + dispatch::{DispatchInfo, DispatchResultWithPostInfo, GetDispatchInfo, PostDispatchInfo}, ensure, match_types, parameter_types, sp_runtime::{traits::Dispatchable, DispatchError, DispatchErrorWithPostInfo}, - traits::{ConstU32, Contains, Get, IsInVec}, + traits::{Contains, Get, IsInVec}, }; pub use parity_scale_codec::{Decode, Encode}; -pub use sp_io::hashing::blake2_256; pub use sp_std::{ cell::{Cell, RefCell}, collections::{btree_map::BTreeMap, btree_set::BTreeSet}, fmt::Debug, - marker::PhantomData, }; pub use xcm::latest::{prelude::*, Weight}; use xcm_executor::traits::{Properties, QueryHandler, QueryResponseStatus}; diff --git a/substrate/client/chain-spec/src/genesis_config_builder.rs b/substrate/client/chain-spec/src/genesis_config_builder.rs index 68f3d8860495..d6ef99fafdd0 100644 --- a/substrate/client/chain-spec/src/genesis_config_builder.rs +++ b/substrate/client/chain-spec/src/genesis_config_builder.rs @@ -141,7 +141,7 @@ where mod tests { use super::*; use serde_json::{from_str, json}; - pub use sp_consensus_babe::{AllowedSlots, BabeEpochConfiguration, Slot}; + pub use sp_consensus_babe::{AllowedSlots, BabeEpochConfiguration}; #[test] fn get_default_config_works() { diff --git a/substrate/frame/alliance/src/mock.rs b/substrate/frame/alliance/src/mock.rs index ace5214f145f..01e0e01fe7ec 100644 --- a/substrate/frame/alliance/src/mock.rs +++ b/substrate/frame/alliance/src/mock.rs @@ -19,16 +19,12 @@ pub use sp_core::H256; use sp_runtime::traits::Hash; -pub use sp_runtime::{ - traits::{BlakeTwo256, IdentityLookup}, - BuildStorage, -}; +pub use sp_runtime::{traits::BlakeTwo256, BuildStorage}; use sp_std::convert::{TryFrom, TryInto}; pub use frame_support::{ assert_noop, assert_ok, derive_impl, ord_parameter_types, parameter_types, - traits::{EitherOfDiverse, SortedMembers}, - BoundedVec, + traits::EitherOfDiverse, BoundedVec, }; use frame_system::{EnsureRoot, EnsureSignedBy}; use pallet_identity::{ diff --git a/substrate/frame/assets/src/benchmarking.rs b/substrate/frame/assets/src/benchmarking.rs index f8495a1c8f24..8fe5a7e2493a 100644 --- a/substrate/frame/assets/src/benchmarking.rs +++ b/substrate/frame/assets/src/benchmarking.rs @@ -102,7 +102,7 @@ fn add_sufficients, I: 'static>(minter: T::AccountId, n: u32) { fn add_approvals, I: 'static>(minter: T::AccountId, n: u32) { let asset_id = default_asset_id::(); - T::Currency::deposit_creating( + let _ = T::Currency::deposit_creating( &minter, T::ApprovalDeposit::get() * n.into() + T::Currency::minimum_balance(), ); diff --git a/substrate/frame/beefy/src/mock.rs b/substrate/frame/beefy/src/mock.rs index 8dc30614c33b..8828fa362185 100644 --- a/substrate/frame/beefy/src/mock.rs +++ b/substrate/frame/beefy/src/mock.rs @@ -37,10 +37,7 @@ use sp_state_machine::BasicExternalities; use crate as pallet_beefy; -pub use sp_consensus_beefy::{ - ecdsa_crypto::{AuthorityId as BeefyId, AuthoritySignature as BeefySignature}, - ConsensusLog, EquivocationProof, BEEFY_ENGINE_ID, -}; +pub use sp_consensus_beefy::{ecdsa_crypto::AuthorityId as BeefyId, ConsensusLog, BEEFY_ENGINE_ID}; impl_opaque_keys! { pub struct MockSessionKeys { diff --git a/substrate/frame/broker/src/lib.rs b/substrate/frame/broker/src/lib.rs index 42895512ec02..ee3501d56071 100644 --- a/substrate/frame/broker/src/lib.rs +++ b/substrate/frame/broker/src/lib.rs @@ -42,9 +42,7 @@ pub use weights::WeightInfo; pub use adapt_price::*; pub use core_mask::*; pub use coretime_interface::*; -pub use nonfungible_impl::*; pub use types::*; -pub use utility_impls::*; #[frame_support::pallet] pub mod pallet { diff --git a/substrate/frame/contracts/src/migration/v10.rs b/substrate/frame/contracts/src/migration/v10.rs index f02e28f6fde3..22fad38739e7 100644 --- a/substrate/frame/contracts/src/migration/v10.rs +++ b/substrate/frame/contracts/src/migration/v10.rs @@ -219,7 +219,7 @@ where "Failed to transfer the base deposit, reason: {:?}", err ); - OldCurrency::deposit_creating(&deposit_account, min_balance); + let _ = OldCurrency::deposit_creating(&deposit_account, min_balance); min_balance }); diff --git a/substrate/frame/contracts/src/wasm/mod.rs b/substrate/frame/contracts/src/wasm/mod.rs index 448c0dd74960..4650a9bc79a3 100644 --- a/substrate/frame/contracts/src/wasm/mod.rs +++ b/substrate/frame/contracts/src/wasm/mod.rs @@ -25,13 +25,15 @@ mod runtime; pub use crate::wasm::runtime::api_doc; pub use crate::wasm::runtime::{ - AllowDeprecatedInterface, AllowUnstableInterface, Environment, ReturnErrorCode, Runtime, - RuntimeCosts, + AllowDeprecatedInterface, AllowUnstableInterface, Environment, Runtime, RuntimeCosts, }; -pub use pallet_contracts_uapi::ReturnFlags; + #[cfg(test)] pub use tests::MockExt; +#[cfg(test)] +pub use crate::wasm::runtime::ReturnErrorCode; + use crate::{ exec::{ExecResult, Executable, ExportedFunction, Ext}, gas::{GasMeter, Token}, diff --git a/substrate/frame/election-provider-multi-phase/src/mock.rs b/substrate/frame/election-provider-multi-phase/src/mock.rs index af126f08d510..e7dd8acf36b1 100644 --- a/substrate/frame/election-provider-multi-phase/src/mock.rs +++ b/substrate/frame/election-provider-multi-phase/src/mock.rs @@ -21,7 +21,7 @@ use frame_election_provider_support::{ bounds::{DataProviderBounds, ElectionBounds}, data_provider, onchain, ElectionDataProvider, NposSolution, SequentialPhragmen, }; -pub use frame_support::{assert_noop, assert_ok, derive_impl, pallet_prelude::GetDefault}; +pub use frame_support::derive_impl; use frame_support::{ parameter_types, traits::{ConstU32, Hooks}, @@ -117,7 +117,7 @@ pub fn roll_to_round(n: u32) { while MultiPhase::round() != n { roll_to_signed(); - assert_ok!(MultiPhase::elect()); + frame_support::assert_ok!(MultiPhase::elect()); } } @@ -638,9 +638,9 @@ impl ExtBuilder { #[cfg(feature = "try-runtime")] ext.execute_with(|| { - assert_ok!(>::try_state( - System::block_number() - )); + frame_support::assert_ok!( + >::try_state(System::block_number()) + ); }); } } diff --git a/substrate/frame/elections-phragmen/src/benchmarking.rs b/substrate/frame/elections-phragmen/src/benchmarking.rs index 9878f7fd41c0..55bb1b968fa1 100644 --- a/substrate/frame/elections-phragmen/src/benchmarking.rs +++ b/substrate/frame/elections-phragmen/src/benchmarking.rs @@ -38,7 +38,7 @@ fn endowed_account(name: &'static str, index: u32) -> T::AccountId { let _ = T::Currency::make_free_balance_be(&account, amount); // important to increase the total issuance since T::CurrencyToVote will need it to be sane for // phragmen to work. - T::Currency::issue(amount); + let _ = T::Currency::issue(amount); account } diff --git a/substrate/frame/fast-unstake/src/lib.rs b/substrate/frame/fast-unstake/src/lib.rs index 153b6c2c353f..04a50543bcc9 100644 --- a/substrate/frame/fast-unstake/src/lib.rs +++ b/substrate/frame/fast-unstake/src/lib.rs @@ -571,7 +571,7 @@ pub mod pallet { .any(|e| T::Staking::is_exposed_in_era(&stash, e)); if is_exposed { - T::Currency::slash_reserved(&stash, deposit); + let _ = T::Currency::slash_reserved(&stash, deposit); log!(info, "slashed {:?} by {:?}", stash, deposit); Self::deposit_event(Event::::Slashed { stash, amount: deposit }); false diff --git a/substrate/frame/indices/src/lib.rs b/substrate/frame/indices/src/lib.rs index 3c0b49304131..ff12d092cfb8 100644 --- a/substrate/frame/indices/src/lib.rs +++ b/substrate/frame/indices/src/lib.rs @@ -223,7 +223,7 @@ pub mod pallet { let (account, amount, perm) = maybe_value.take().ok_or(Error::::NotAssigned)?; ensure!(!perm, Error::::Permanent); ensure!(account == who, Error::::NotOwner); - T::Currency::slash_reserved(&who, amount); + let _ = T::Currency::slash_reserved(&who, amount); *maybe_value = Some((account, Zero::zero(), true)); Ok(()) })?; diff --git a/substrate/frame/lottery/src/lib.rs b/substrate/frame/lottery/src/lib.rs index c54f6d76803f..54a8edd38606 100644 --- a/substrate/frame/lottery/src/lib.rs +++ b/substrate/frame/lottery/src/lib.rs @@ -368,7 +368,8 @@ pub mod pallet { // Make sure pot exists. let lottery_account = Self::account_id(); if T::Currency::total_balance(&lottery_account).is_zero() { - T::Currency::deposit_creating(&lottery_account, T::Currency::minimum_balance()); + let _ = + T::Currency::deposit_creating(&lottery_account, T::Currency::minimum_balance()); } Self::deposit_event(Event::::LotteryStarted); Ok(()) diff --git a/substrate/frame/paged-list/src/paged_list.rs b/substrate/frame/paged-list/src/paged_list.rs index beea8ecc6440..75467f3ceeb5 100644 --- a/substrate/frame/paged-list/src/paged_list.rs +++ b/substrate/frame/paged-list/src/paged_list.rs @@ -407,13 +407,11 @@ where #[allow(dead_code)] pub(crate) mod mock { pub use super::*; - pub use frame_support::{ - parameter_types, - storage::{types::ValueQuery, StorageList as _}, - StorageNoopGuard, - }; - pub use sp_io::{hashing::twox_128, TestExternalities}; - pub use sp_metadata_ir::{StorageEntryModifierIR, StorageEntryTypeIR, StorageHasherIR}; + pub use frame_support::parameter_types; + #[cfg(test)] + pub use frame_support::{storage::StorageList as _, StorageNoopGuard}; + #[cfg(test)] + pub use sp_io::TestExternalities; parameter_types! { pub const ValuesPerNewPage: u32 = 5; diff --git a/substrate/frame/staking/src/benchmarking.rs b/substrate/frame/staking/src/benchmarking.rs index abb78b7e3040..f1159c06aa11 100644 --- a/substrate/frame/staking/src/benchmarking.rs +++ b/substrate/frame/staking/src/benchmarking.rs @@ -250,7 +250,7 @@ benchmarks! { let original_bonded: BalanceOf = Ledger::::get(&controller).map(|l| l.active).ok_or("ledger not created after")?; - T::Currency::deposit_into_existing(&stash, max_additional).unwrap(); + let _ = T::Currency::deposit_into_existing(&stash, max_additional).unwrap(); whitelist_account!(stash); }: _(RawOrigin::Signed(stash), max_additional) diff --git a/substrate/frame/support/src/dispatch.rs b/substrate/frame/support/src/dispatch.rs index 449b6f23165a..4a313551aca6 100644 --- a/substrate/frame/support/src/dispatch.rs +++ b/substrate/frame/support/src/dispatch.rs @@ -664,7 +664,7 @@ mod weight_tests { use sp_runtime::{generic, traits::BlakeTwo256}; use sp_weights::RuntimeDbWeight; - pub use self::frame_system::{Call, Config, Pallet}; + pub use self::frame_system::{Call, Config}; fn from_actual_ref_time(ref_time: Option) -> PostDispatchInfo { PostDispatchInfo { diff --git a/substrate/primitives/database/src/lib.rs b/substrate/primitives/database/src/lib.rs index 012f699552d7..42920bbefb49 100644 --- a/substrate/primitives/database/src/lib.rs +++ b/substrate/primitives/database/src/lib.rs @@ -101,7 +101,9 @@ pub trait Database>: Send + Sync { /// This may be faster than `get` since it doesn't allocate. /// Use `with_get` helper function if you need `f` to return a value from `f` fn with_get(&self, col: ColumnId, key: &[u8], f: &mut dyn FnMut(&[u8])) { - self.get(col, key).map(|v| f(&v)); + if let Some(v) = self.get(col, key) { + f(&v) + } } /// Check if database supports internal ref counting for state data. diff --git a/substrate/primitives/runtime-interface/proc-macro/src/utils.rs b/substrate/primitives/runtime-interface/proc-macro/src/utils.rs index 9818fd6842a6..7d97f9f3e1ca 100644 --- a/substrate/primitives/runtime-interface/proc-macro/src/utils.rs +++ b/substrate/primitives/runtime-interface/proc-macro/src/utils.rs @@ -89,7 +89,7 @@ struct RuntimeInterfaceFunctionSet { impl RuntimeInterfaceFunctionSet { fn new(version: VersionAttribute, trait_item: &TraitItemFn) -> Result { Ok(Self { - latest_version_to_call: version.is_callable().then(|| version.version), + latest_version_to_call: version.is_callable().then_some(version.version), versions: BTreeMap::from([( version.version, RuntimeInterfaceFunction::new(trait_item)?, diff --git a/substrate/primitives/storage/src/lib.rs b/substrate/primitives/storage/src/lib.rs index f8dc40f051c2..3528d0558f53 100644 --- a/substrate/primitives/storage/src/lib.rs +++ b/substrate/primitives/storage/src/lib.rs @@ -414,12 +414,13 @@ impl ChildTrieParentKeyId { /// /// V0 and V1 uses a same trie implementation, but V1 will write external value node in the trie for /// value with size at least `TRIE_VALUE_NODE_THRESHOLD`. -#[derive(Debug, Clone, Copy, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)] #[cfg_attr(feature = "std", derive(Encode, Decode))] pub enum StateVersion { /// Old state version, no value nodes. V0 = 0, /// New state version can use value nodes. + #[default] V1 = 1, } @@ -432,12 +433,6 @@ impl Display for StateVersion { } } -impl Default for StateVersion { - fn default() -> Self { - StateVersion::V1 - } -} - impl From for u8 { fn from(version: StateVersion) -> u8 { version as u8 diff --git a/substrate/utils/build-script-utils/src/git.rs b/substrate/utils/build-script-utils/src/git.rs index 057ee0af15f7..430a3e17c190 100644 --- a/substrate/utils/build-script-utils/src/git.rs +++ b/substrate/utils/build-script-utils/src/git.rs @@ -15,7 +15,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::{env, fs, fs::File, io, io::Read, path::PathBuf}; +use std::{ + env, fs, + fs::File, + io, + io::Read, + path::{Path, PathBuf}, +}; /// Make sure the calling `build.rs` script is rerun when `.git/HEAD` or the ref of `.git/HEAD` /// changed. @@ -55,7 +61,7 @@ pub fn rerun_if_git_head_changed() { } // Code taken from https://github.com/rustyhorde/vergen/blob/8d522db8c8e16e26c0fc9ea8e6b0247cbf5cca84/src/output/envvar.rs -fn get_git_paths(path: &PathBuf) -> Result>, io::Error> { +fn get_git_paths(path: &Path) -> Result>, io::Error> { let git_dir_or_file = path.join(".git"); if let Ok(metadata) = fs::metadata(&git_dir_or_file) { diff --git a/substrate/utils/build-script-utils/src/version.rs b/substrate/utils/build-script-utils/src/version.rs index 549e499b1102..d85c78d2c997 100644 --- a/substrate/utils/build-script-utils/src/version.rs +++ b/substrate/utils/build-script-utils/src/version.rs @@ -25,7 +25,7 @@ pub fn generate_cargo_keys() { // We deliberately set the length here to `11` to ensure that // the emitted hash is always of the same length; otherwise // it can (and will!) vary between different build environments. - match Command::new("git").args(&["rev-parse", "--short=11", "HEAD"]).output() { + match Command::new("git").args(["rev-parse", "--short=11", "HEAD"]).output() { Ok(o) if o.status.success() => { let sha = String::from_utf8_lossy(&o.stdout).trim().to_owned(); Cow::from(sha)