diff --git a/distance-oracle/src/lib.rs b/distance-oracle/src/lib.rs index c59d89b7c97fbbb29fd739dfaf44357262eb95e8..53a7503ea28f577684febf1ce09c2744746ba29b 100644 --- a/distance-oracle/src/lib.rs +++ b/distance-oracle/src/lib.rs @@ -29,10 +29,8 @@ use api::{AccountId, IdtyIndex}; use codec::Encode; use fnv::{FnvHashMap, FnvHashSet}; use log::{debug, error, info, warn}; -use rayon::iter::IntoParallelRefIterator; -use rayon::iter::ParallelIterator; -use std::io::Write; -use std::path::PathBuf; +use rayon::iter::{IntoParallelRefIterator, ParallelIterator}; +use std::{io::Write, path::PathBuf}; // TODO select metadata file using features #[subxt::subxt(runtime_metadata_path = "../resources/metadata.scale")] diff --git a/end2end-tests/tests/common/balances.rs b/end2end-tests/tests/common/balances.rs index 9329a5fe13bcf9ca6081cd783611ef17c5b934c6..e7b703736316ea3bcd02bfcb932ed611263324de 100644 --- a/end2end-tests/tests/common/balances.rs +++ b/end2end-tests/tests/common/balances.rs @@ -14,9 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. -use super::gdev; -use super::gdev::runtime_types::pallet_balances; -use super::*; +use super::{gdev, gdev::runtime_types::pallet_balances, *}; use sp_keyring::AccountKeyring; use subxt::{tx::PairSigner, utils::MultiAddress}; diff --git a/end2end-tests/tests/common/cert.rs b/end2end-tests/tests/common/cert.rs index 86efaed685f7a8962949df0d1c6facf9576b5612..8ca1d080a419664358b29563ddc861d48be40043 100644 --- a/end2end-tests/tests/common/cert.rs +++ b/end2end-tests/tests/common/cert.rs @@ -14,9 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. -use super::gdev; -use super::gdev::runtime_types::pallet_certification; -use super::*; +use super::{gdev, gdev::runtime_types::pallet_certification, *}; use sp_keyring::AccountKeyring; use subxt::{tx::PairSigner, utils::MultiAddress}; diff --git a/end2end-tests/tests/common/distance.rs b/end2end-tests/tests/common/distance.rs index 97add31a313804b983b61b3d5feb4228dc9593f9..29a3a12c986e4bbd976a36abad14ce9efbf12ff8 100644 --- a/end2end-tests/tests/common/distance.rs +++ b/end2end-tests/tests/common/distance.rs @@ -14,14 +14,14 @@ // You should have received a copy of the GNU Affero General Public License // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. -use super::gdev; -use super::gdev::runtime_types::pallet_identity; -use super::*; +use super::{gdev, gdev::runtime_types::pallet_identity, *}; use crate::DuniterWorld; use sp_keyring::AccountKeyring; -use subxt::backend::rpc::RpcClient; -use subxt::tx::{PairSigner, Signer}; -use subxt::utils::AccountId32; +use subxt::{ + backend::rpc::RpcClient, + tx::{PairSigner, Signer}, + utils::AccountId32, +}; pub async fn request_evaluation(client: &FullClient, origin: AccountKeyring) -> Result<()> { let origin = PairSigner::new(origin.pair()); diff --git a/end2end-tests/tests/common/identity.rs b/end2end-tests/tests/common/identity.rs index ab42cff025a9044cc3b23646fa1de82ef4ead41b..da532a67edc83e9bcbec3bae4af19a5c7013402a 100644 --- a/end2end-tests/tests/common/identity.rs +++ b/end2end-tests/tests/common/identity.rs @@ -14,11 +14,8 @@ // You should have received a copy of the GNU Affero General Public License // along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. -use super::gdev; -use super::gdev::runtime_types::pallet_identity; -use super::*; -use crate::gdev::runtime_types::pallet_identity::types::IdtyName; -use crate::DuniterWorld; +use super::{gdev, gdev::runtime_types::pallet_identity, *}; +use crate::{gdev::runtime_types::pallet_identity::types::IdtyName, DuniterWorld}; use sp_keyring::AccountKeyring; use subxt::tx::PairSigner; diff --git a/end2end-tests/tests/common/mod.rs b/end2end-tests/tests/common/mod.rs index 87df5c301f3d6d12ba41856b42ebdb3e2c968572..6ed0e8375c02367af9262d01261c2b198474a5a2 100644 --- a/end2end-tests/tests/common/mod.rs +++ b/end2end-tests/tests/common/mod.rs @@ -33,17 +33,19 @@ use codec::Encode; use notify_debouncer_mini::new_debouncer; use serde_json::Value; use sp_keyring::AccountKeyring; -use std::io::prelude::*; -use std::path::{Path, PathBuf}; -use std::process::Command; -use std::str::FromStr; -use std::time::{Duration, Instant}; -use subxt::backend::rpc::RpcClient; -use subxt::backend::rpc::RpcParams; -use subxt::config::substrate::SubstrateExtrinsicParamsBuilder; -use subxt::config::SubstrateExtrinsicParams; -use subxt::ext::{sp_core, sp_runtime}; -use subxt::rpc_params; +use std::{ + io::prelude::*, + path::{Path, PathBuf}, + process::Command, + str::FromStr, + time::{Duration, Instant}, +}; +use subxt::{ + backend::rpc::{RpcClient, RpcParams}, + config::{substrate::SubstrateExtrinsicParamsBuilder, SubstrateExtrinsicParams}, + ext::{sp_core, sp_runtime}, + rpc_params, +}; pub type Client = subxt::OnlineClient<GdevConfig>; pub type Event = gdev::Event; diff --git a/end2end-tests/tests/common/oneshot.rs b/end2end-tests/tests/common/oneshot.rs index 51478d12978f6432da50e06c7d47e180dae32a63..bcfe65dc84f06c40a5b6fbc530180633e750bae6 100644 --- a/end2end-tests/tests/common/oneshot.rs +++ b/end2end-tests/tests/common/oneshot.rs @@ -14,13 +14,16 @@ // You should have received a copy of the GNU Affero General Public License // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. -use super::gdev; -use super::gdev::runtime_types::pallet_balances; -use super::gdev::runtime_types::pallet_oneshot_account; -use super::*; +use super::{ + gdev, + gdev::runtime_types::{pallet_balances, pallet_oneshot_account}, + *, +}; use sp_keyring::AccountKeyring; -use subxt::utils::AccountId32; -use subxt::{tx::PairSigner, utils::MultiAddress}; +use subxt::{ + tx::PairSigner, + utils::{AccountId32, MultiAddress}, +}; pub enum Account { Normal(AccountKeyring), diff --git a/end2end-tests/tests/cucumber_tests.rs b/end2end-tests/tests/cucumber_tests.rs index 5c174c954d817b8a5ec0751818e82f2bf7359060..4b35e0242c0d9ceab4436b567131c9c4d9bf68f7 100644 --- a/end2end-tests/tests/cucumber_tests.rs +++ b/end2end-tests/tests/cucumber_tests.rs @@ -17,14 +17,15 @@ mod common; use common::*; -use cucumber::StatsWriter; -use cucumber::{given, then, when, World}; +use cucumber::{given, then, when, StatsWriter, World}; use sp_keyring::AccountKeyring; -use std::path::PathBuf; -use std::str::FromStr; -use std::sync::{ - atomic::{AtomicBool, Ordering}, - Arc, +use std::{ + path::PathBuf, + str::FromStr, + sync::{ + atomic::{AtomicBool, Ordering}, + Arc, + }, }; use subxt::backend::rpc::RpcClient; diff --git a/live-tests/tests/sanity_gdev.rs b/live-tests/tests/sanity_gdev.rs index 28a9a0387d2351d71416cadc84ddeb0cf47fe8ed..ca6ded3e811b6c576b1d8f4a037474cadaf7dd47 100644 --- a/live-tests/tests/sanity_gdev.rs +++ b/live-tests/tests/sanity_gdev.rs @@ -18,11 +18,9 @@ pub mod gdev {} use countmap::CountMap; -use sp_core::crypto::AccountId32; -use sp_core::{blake2_128, ByteArray, H256}; +use sp_core::{blake2_128, crypto::AccountId32, ByteArray, H256}; use std::collections::{HashMap, HashSet}; -use subxt::backend::rpc::RpcClient; -use subxt::config::SubstrateConfig as GdevConfig; +use subxt::{backend::rpc::RpcClient, config::SubstrateConfig as GdevConfig}; const DEFAULT_ENDPOINT: &str = "ws://localhost:9944"; @@ -48,8 +46,7 @@ type IdtyIndex = u32; type IdtyValue = gdev::runtime_types::pallet_identity::types::IdtyValue<BlockNumber, AccountId32, IdtyData>; type MembershipData = gdev::runtime_types::sp_membership::MembershipData<BlockNumber>; -use gdev::runtime_types::pallet_identity::types::IdtyName; -use gdev::runtime_types::pallet_identity::types::IdtyStatus; +use gdev::runtime_types::pallet_identity::types::{IdtyName, IdtyStatus}; struct Storage { accounts: HashMap<AccountId32, AccountInfo>, diff --git a/node/src/chain_spec/gdev.rs b/node/src/chain_spec/gdev.rs index 45a6f051423d9cc5e3e5d774389f7bc7941e3413..370da7b0b27b4054089196d3e4f56a7860c703d3 100644 --- a/node/src/chain_spec/gdev.rs +++ b/node/src/chain_spec/gdev.rs @@ -18,10 +18,7 @@ use super::*; use crate::chain_spec::gen_genesis_data::{ AuthorityKeys, CommonParameters, GenesisIdentity, SessionKeysProvider, }; -use common_runtime::constants::*; -use common_runtime::entities::IdtyData; -use common_runtime::GenesisIdty; -use common_runtime::IdtyStatus; +use common_runtime::{constants::*, entities::IdtyData, GenesisIdty, IdtyStatus}; use gdev_runtime::{ opaque::SessionKeys, pallet_universal_dividend, parameters, Runtime, RuntimeGenesisConfig, WASM_BINARY, diff --git a/node/src/chain_spec/gen_genesis_data.rs b/node/src/chain_spec/gen_genesis_data.rs index b6ce08e5f022bac5bb6ef8d3ac5c5011802c3bd8..8807e1453cc48a492529c7b564a18dc625123458 100644 --- a/node/src/chain_spec/gen_genesis_data.rs +++ b/node/src/chain_spec/gen_genesis_data.rs @@ -15,8 +15,10 @@ // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. use crate::chain_spec::{get_account_id_from_seed, get_from_seed, AccountPublic}; -use common_runtime::constants::{DAYS, MILLISECS_PER_BLOCK}; -use common_runtime::*; +use common_runtime::{ + constants::{DAYS, MILLISECS_PER_BLOCK}, + *, +}; use log::{error, warn}; use num_format::{Locale, ToFormattedString}; use pallet_im_online::sr25519::AuthorityId as ImOnlineId; @@ -24,14 +26,17 @@ use serde::{de::DeserializeOwned, Deserialize, Serialize}; use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; use sp_consensus_babe::AuthorityId as BabeId; use sp_consensus_grandpa::AuthorityId as GrandpaId; -use sp_core::crypto::AccountId32; -use sp_core::{ed25519, sr25519, Decode, Encode}; -use sp_runtime::traits::{IdentifyAccount, Verify}; -use sp_runtime::{MultiSignature, Perbill}; -use std::collections::{BTreeMap, HashMap}; -use std::fmt::{Display, Formatter}; -use std::fs; -use std::ops::{Add, Sub}; +use sp_core::{crypto::AccountId32, ed25519, sr25519, Decode, Encode}; +use sp_runtime::{ + traits::{IdentifyAccount, Verify}, + MultiSignature, Perbill, +}; +use std::{ + collections::{BTreeMap, HashMap}, + fmt::{Display, Formatter}, + fs, + ops::{Add, Sub}, +}; static G1_DUNITER_V1_EXISTENTIAL_DEPOSIT: u64 = 100; static G1_DUNITER_V1_DECIMALS: usize = 2; @@ -2064,8 +2069,10 @@ fn seconds_to_blocs(seconds: u32) -> u32 { #[cfg(test)] mod tests { use super::*; - use sp_core::crypto::{Ss58AddressFormat, Ss58Codec}; - use sp_core::ByteArray; + use sp_core::{ + crypto::{Ss58AddressFormat, Ss58Codec}, + ByteArray, + }; use std::str::FromStr; #[test] diff --git a/node/src/chain_spec/gtest.rs b/node/src/chain_spec/gtest.rs index 018b130b0254e9fdf1074db8b69517657a6e9de3..3154b76cf236a83e14676a65cfa0338c31cbc9bb 100644 --- a/node/src/chain_spec/gtest.rs +++ b/node/src/chain_spec/gtest.rs @@ -16,14 +16,10 @@ use super::*; use crate::chain_spec::gen_genesis_data::{CommonParameters, GenesisIdentity, SessionKeysProvider}; -use common_runtime::constants::*; -use common_runtime::entities::IdtyData; -use common_runtime::GenesisIdty; -use common_runtime::IdtyStatus; -use gtest_runtime::ImOnlineId; +use common_runtime::{constants::*, entities::IdtyData, GenesisIdty, IdtyStatus}; use gtest_runtime::{ - opaque::SessionKeys, pallet_universal_dividend, parameters, AccountId, Perbill, Runtime, - RuntimeGenesisConfig, WASM_BINARY, + opaque::SessionKeys, pallet_universal_dividend, parameters, AccountId, ImOnlineId, Perbill, + Runtime, RuntimeGenesisConfig, WASM_BINARY, }; use jsonrpsee::core::JsonValue; use sc_consensus_grandpa::AuthorityId as GrandpaId; diff --git a/node/src/command.rs b/node/src/command.rs index 3303d99b00ab933b08f9ac9ecedba6d07857cb50..9b0f335c33e3af957ded3b2b268658391e0b2038 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -20,10 +20,12 @@ pub mod key; pub mod utils; -use crate::cli::{Cli, Subcommand}; -use crate::service::runtime_executor::Executor; -use crate::service::RuntimeType; -use crate::{chain_spec, service}; +use crate::{ + chain_spec, + cli::{Cli, Subcommand}, + service, + service::{runtime_executor::Executor, RuntimeType}, +}; use clap::CommandFactory; #[cfg(feature = "runtime-benchmarks")] use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE}; diff --git a/node/src/rpc.rs b/node/src/rpc.rs index 301d4ce9febc08b08b9f4adfec31b5b1664e4ead..e61d608f5fb16c2fd8cc7c2e944d315538731019 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -23,11 +23,9 @@ pub use sc_rpc_api::DenyUnsafe; -use common_runtime::Block; -use common_runtime::{AccountId, Balance, Index}; +use common_runtime::{AccountId, Balance, Block, Index}; use jsonrpsee::RpcModule; -use sc_consensus_babe::BabeApi; -use sc_consensus_babe::BabeWorkerHandle; +use sc_consensus_babe::{BabeApi, BabeWorkerHandle}; use sc_transaction_pool_api::TransactionPool; use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder; diff --git a/node/src/service.rs b/node/src/service.rs index e71e3709f3aa9cc33d99985607547899692290c5..8ce3d3c2b0625b29533ed6d037b041a30ea961bc 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -22,12 +22,12 @@ use self::client::{Client, ClientHandle, RuntimeApiCollection}; use async_io::Timer; use common_runtime::Block; use futures::{Stream, StreamExt}; -use sc_client_api::client::BlockBackend; -use sc_client_api::Backend; +use sc_client_api::{client::BlockBackend, Backend}; use sc_consensus_grandpa::SharedVoterState; use sc_consensus_manual_seal::{run_manual_seal, EngineCommand, ManualSealParams}; -use sc_service::WarpSyncParams; -use sc_service::{error::Error as ServiceError, Configuration, PartialComponents, TaskManager}; +use sc_service::{ + error::Error as ServiceError, Configuration, PartialComponents, TaskManager, WarpSyncParams, +}; use sc_telemetry::{Telemetry, TelemetryWorker}; use sp_consensus_babe::inherents::InherentDataProvider; use sp_core::H256; diff --git a/node/src/service/client.rs b/node/src/service/client.rs index d9019c6825fe9e406a963dd4a244c9f509b8ca54..34fbea16a7e4ae512759761d3a9a7d5359865873 100644 --- a/node/src/service/client.rs +++ b/node/src/service/client.rs @@ -15,9 +15,9 @@ // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. use common_runtime::{AccountId, Balance, Block, BlockNumber, Hash, Header, Index}; -use sc_client_api::MerkleValue; use sc_client_api::{ - AuxStore, Backend as BackendT, BlockchainEvents, KeysIter, PairsIter, UsageProvider, + AuxStore, Backend as BackendT, BlockchainEvents, KeysIter, MerkleValue, PairsIter, + UsageProvider, }; use sp_api::{CallApiAt, ProvideRuntimeApi}; use sp_blockchain::{HeaderBackend, HeaderMetadata}; diff --git a/pallets/authority-members/src/impls.rs b/pallets/authority-members/src/impls.rs index 6a1930e3f42ed0a98fc865ce7b4bcaf483c630af..337f4689584f66d2296bc585cc562ac86e9d5086 100644 --- a/pallets/authority-members/src/impls.rs +++ b/pallets/authority-members/src/impls.rs @@ -23,13 +23,10 @@ #![allow(clippy::type_complexity)] use super::pallet::*; -use frame_support::pallet_prelude::Weight; -use frame_support::traits::Get; -use pallet_offences::traits::OnOffenceHandler; -use pallet_offences::SlashStrategy; +use frame_support::{pallet_prelude::Weight, traits::Get}; +use pallet_offences::{traits::OnOffenceHandler, SlashStrategy}; use sp_runtime::traits::Convert; -use sp_staking::offence::OffenceDetails; -use sp_staking::SessionIndex; +use sp_staking::{offence::OffenceDetails, SessionIndex}; impl<T: Config> OnOffenceHandler<T::AccountId, pallet_session::historical::IdentificationTuple<T>, Weight> diff --git a/pallets/authority-members/src/lib.rs b/pallets/authority-members/src/lib.rs index 963a180b59a92982758d71828484d7b7eabdb657..052d4130a4fcb68ef538d69bea94b278af3fbff9 100644 --- a/pallets/authority-members/src/lib.rs +++ b/pallets/authority-members/src/lib.rs @@ -45,13 +45,13 @@ use sp_std::prelude::*; #[frame_support::pallet] pub mod pallet { use super::*; - use frame_support::pallet_prelude::*; - use frame_support::traits::ValidatorRegistration; - use frame_support::traits::{StorageVersion, UnfilteredDispatchable}; + use frame_support::{ + pallet_prelude::*, + traits::{StorageVersion, UnfilteredDispatchable, ValidatorRegistration}, + }; use frame_system::pallet_prelude::*; use sp_runtime::traits::{Convert, IsMember}; - use sp_std::collections::btree_map::BTreeMap; - use sp_std::vec; + use sp_std::{collections::btree_map::BTreeMap, vec}; /// The current storage version. const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); diff --git a/pallets/authority-members/src/mock.rs b/pallets/authority-members/src/mock.rs index 34b26a9220901cada607e7cb14f7942cf5d25ae5..15db413e53382f2912cc69a7529133f23a2a8333 100644 --- a/pallets/authority-members/src/mock.rs +++ b/pallets/authority-members/src/mock.rs @@ -18,16 +18,14 @@ use super::*; use crate::{self as pallet_authority_members}; use frame_support::{pallet_prelude::*, parameter_types, traits::Everything}; use frame_system as system; -use pallet_offences::traits::OnOffenceHandler; -use pallet_offences::SlashStrategy; +use pallet_offences::{traits::OnOffenceHandler, SlashStrategy}; use pallet_session::ShouldEndSession; use sp_core::{crypto::key_types::DUMMY, H256}; -use sp_runtime::BuildStorage; use sp_runtime::{ impl_opaque_keys, testing::UintAuthorityId, traits::{BlakeTwo256, ConvertInto, IdentityLookup, IsMember, OpaqueKeys}, - KeyTypeId, + BuildStorage, KeyTypeId, }; use sp_staking::offence::OffenceDetails; use sp_state_machine::BasicExternalities; diff --git a/pallets/authority-members/src/tests.rs b/pallets/authority-members/src/tests.rs index 12e1d13dd570291f13e13b455bddfef6c638d23a..35dbced547b14c81c773c8286a97a88e0bd3e37f 100644 --- a/pallets/authority-members/src/tests.rs +++ b/pallets/authority-members/src/tests.rs @@ -18,8 +18,7 @@ use super::*; use crate::mock::*; use frame_support::{assert_err, assert_noop, assert_ok}; use frame_system::RawOrigin; -use sp_runtime::testing::UintAuthorityId; -use sp_runtime::traits::BadOrigin; +use sp_runtime::{testing::UintAuthorityId, traits::BadOrigin}; use sp_staking::offence::OffenceDetails; const EMPTY: Vec<u64> = Vec::new(); diff --git a/pallets/certification/src/lib.rs b/pallets/certification/src/lib.rs index b2061d396db5ddaa71c2fd01e951e2490cada2ce..01df9634942b863530bfe7f9fe57ee7e85e610a9 100644 --- a/pallets/certification/src/lib.rs +++ b/pallets/certification/src/lib.rs @@ -37,8 +37,7 @@ pub use weights::WeightInfo; use crate::traits::*; use codec::Codec; use duniter_primitives::Idty; -use frame_support::pallet_prelude::*; -use frame_support::traits::StorageVersion; +use frame_support::{pallet_prelude::*, traits::StorageVersion}; use sp_runtime::traits::AtLeast32BitUnsigned; use sp_std::{fmt::Debug, vec::Vec}; diff --git a/pallets/certification/src/tests.rs b/pallets/certification/src/tests.rs index 0bde9557b9a882ec521a6d06b3d0db90d27df67f..fc8d4fb65db791fcaa9190615a4d4538c2330484 100644 --- a/pallets/certification/src/tests.rs +++ b/pallets/certification/src/tests.rs @@ -14,8 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. -use crate::mock::*; -use crate::{Error, Event}; +use crate::{mock::*, Error, Event}; use frame_support::{assert_noop, assert_ok}; use maplit::btreemap; use sp_std::collections::btree_map::BTreeMap; diff --git a/pallets/distance/src/benchmarking.rs b/pallets/distance/src/benchmarking.rs index bf1a6a519fd0125d28331223ce359c276e82f29d..06e2637fcf09e286087f11f46b5fb5f291715d5b 100644 --- a/pallets/distance/src/benchmarking.rs +++ b/pallets/distance/src/benchmarking.rs @@ -22,8 +22,7 @@ use super::*; use codec::Encode; use frame_benchmarking::v2::*; use frame_support::traits::{Get, OnFinalize, OnInitialize}; -use frame_system::pallet_prelude::BlockNumberFor; -use frame_system::RawOrigin; +use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin}; use sp_runtime::Perbill; use crate::Pallet; diff --git a/pallets/distance/src/lib.rs b/pallets/distance/src/lib.rs index 06e58088fdca6c87f10c2623f17b1a088abc533a..b52e2bb084db727aa30568f5a4d90aaacc2e6006 100644 --- a/pallets/distance/src/lib.rs +++ b/pallets/distance/src/lib.rs @@ -41,8 +41,10 @@ use frame_support::traits::{ }; use sp_distance::{InherentError, INHERENT_IDENTIFIER}; use sp_inherents::{InherentData, InherentIdentifier}; -use sp_runtime::traits::{One, Zero}; -use sp_runtime::Saturating; +use sp_runtime::{ + traits::{One, Zero}, + Saturating, +}; use sp_std::{convert::TryInto, prelude::*}; type IdtyIndex = u32; diff --git a/pallets/distance/src/mock.rs b/pallets/distance/src/mock.rs index 7b2391ce46b9e71789340c1c3cb6ff30a35d5109..0f232b82d1f8a39e870fb4c901e8640a76c71199 100644 --- a/pallets/distance/src/mock.rs +++ b/pallets/distance/src/mock.rs @@ -25,13 +25,12 @@ use frame_system as system; use pallet_balances::AccountData; use pallet_session::ShouldEndSession; use sp_core::{ConstU32, H256}; -use sp_runtime::BuildStorage; use sp_runtime::{ impl_opaque_keys, key_types::DUMMY, testing::{TestSignature, UintAuthorityId}, traits::{BlakeTwo256, ConvertInto, IdentityLookup, IsMember, OpaqueKeys}, - KeyTypeId, Perbill, + BuildStorage, KeyTypeId, Perbill, }; type Balance = u64; diff --git a/pallets/distance/src/tests.rs b/pallets/distance/src/tests.rs index 18302be75c61c8ed2718d33d353e7a49b8148253..4ec3087cbc36f1f10c13e24bfdacbfc40a08c835 100644 --- a/pallets/distance/src/tests.rs +++ b/pallets/distance/src/tests.rs @@ -14,10 +14,8 @@ // You should have received a copy of the GNU Affero General Public License // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. -use crate::mock::*; -use crate::*; -use frame_support::traits::Currency; -use frame_support::{assert_noop, assert_ok}; +use crate::{mock::*, *}; +use frame_support::{assert_noop, assert_ok, traits::Currency}; // allow request distance evaluation for oneself #[test] diff --git a/pallets/duniter-account/src/lib.rs b/pallets/duniter-account/src/lib.rs index 2e131264a222ec8b23c0a5e98e6bd54840aaadcf..514084f8725211cc7e3ecfed5aaa77cfdb91e14e 100644 --- a/pallets/duniter-account/src/lib.rs +++ b/pallets/duniter-account/src/lib.rs @@ -28,8 +28,10 @@ pub use pallet::*; pub use types::*; pub use weights::WeightInfo; -use frame_support::pallet_prelude::*; -use frame_support::traits::{fungible, fungible::Credit, IsSubType, StorageVersion, StoredMap}; +use frame_support::{ + pallet_prelude::*, + traits::{fungible, fungible::Credit, IsSubType, StorageVersion, StoredMap}, +}; use frame_system::pallet_prelude::*; use pallet_quota::traits::RefundFee; use pallet_transaction_payment::OnChargeTransaction; diff --git a/pallets/duniter-test-parameters/src/lib.rs b/pallets/duniter-test-parameters/src/lib.rs index 98db19954b354ca28baded4fff508da6a8426deb..39775e7c42ecbefd0f8e6569dbdc3efff91ab8e9 100644 --- a/pallets/duniter-test-parameters/src/lib.rs +++ b/pallets/duniter-test-parameters/src/lib.rs @@ -65,8 +65,7 @@ pub mod types { #[frame_support::pallet] pub mod pallet { use super::*; - use frame_support::pallet_prelude::*; - use frame_support::traits::StorageVersion; + use frame_support::{pallet_prelude::*, traits::StorageVersion}; /// The current storage version. const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); diff --git a/pallets/duniter-wot/src/mock.rs b/pallets/duniter-wot/src/mock.rs index f73248cc656f0dde192d15028ab5bf921260da32..60148e0ec4b87242d09b3ec558aad7fd36002677 100644 --- a/pallets/duniter-wot/src/mock.rs +++ b/pallets/duniter-wot/src/mock.rs @@ -19,10 +19,10 @@ use crate::{self as pallet_duniter_wot}; use frame_support::{parameter_types, traits::Everything}; use frame_system as system; use sp_core::H256; -use sp_runtime::BuildStorage; use sp_runtime::{ testing::{TestSignature, UintAuthorityId}, traits::{BlakeTwo256, IdentityLookup}, + BuildStorage, }; use sp_state_machine::BasicExternalities; use std::collections::BTreeMap; diff --git a/pallets/duniter-wot/src/tests.rs b/pallets/duniter-wot/src/tests.rs index 515827526523ae876a6c13d7c551a3a9daa08d15..c82be351435b92b532ec752ca1c30f08459d6678 100644 --- a/pallets/duniter-wot/src/tests.rs +++ b/pallets/duniter-wot/src/tests.rs @@ -14,8 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. -use crate::mock::*; -use crate::pallet as pallet_duniter_wot; +use crate::{mock::*, pallet as pallet_duniter_wot}; use codec::Encode; use frame_support::{assert_noop, assert_ok}; use pallet_identity::{ diff --git a/pallets/identity/src/benchmarking.rs b/pallets/identity/src/benchmarking.rs index 734707ae041dea3892db612bf085d42ef67a4233..20e7462133e6d8bc564e1ecd41cd56e82800e6e0 100644 --- a/pallets/identity/src/benchmarking.rs +++ b/pallets/identity/src/benchmarking.rs @@ -19,11 +19,9 @@ use super::*; use codec::Encode; -use frame_benchmarking::account; -use frame_benchmarking::v2::*; +use frame_benchmarking::{account, v2::*}; use frame_support::traits::OnInitialize; -use frame_system::pallet_prelude::BlockNumberFor; -use frame_system::RawOrigin; +use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin}; use sp_core::Get; use sp_io::crypto::{sr25519_generate, sr25519_sign}; use sp_runtime::{AccountId32, MultiSigner}; diff --git a/pallets/identity/src/lib.rs b/pallets/identity/src/lib.rs index 3ff6fde96a18f048df687b6f7cdacb2f38361508..886e62586abedd82752f6dc32b288b4e195d695a 100644 --- a/pallets/identity/src/lib.rs +++ b/pallets/identity/src/lib.rs @@ -38,8 +38,7 @@ use crate::traits::*; use codec::Codec; use frame_support::pallet_prelude::Weight; use sp_runtime::traits::{AtLeast32BitUnsigned, IdentifyAccount, One, Saturating, Verify, Zero}; -use sp_std::fmt::Debug; -use sp_std::prelude::*; +use sp_std::{fmt::Debug, prelude::*}; // icok = identity change owner key pub const NEW_OWNER_KEY_PAYLOAD_PREFIX: [u8; 4] = [b'i', b'c', b'o', b'k']; @@ -51,8 +50,7 @@ pub const LINK_IDTY_PAYLOAD_PREFIX: [u8; 4] = [b'l', b'i', b'n', b'k']; #[frame_support::pallet] pub mod pallet { use super::*; - use frame_support::pallet_prelude::*; - use frame_support::traits::StorageVersion; + use frame_support::{pallet_prelude::*, traits::StorageVersion}; use frame_system::pallet_prelude::*; /// The current storage version. diff --git a/pallets/identity/src/mock.rs b/pallets/identity/src/mock.rs index 81a0dc3566670947f6988f74664b978b8b5c7f7e..e13c48b212238f7dd8a2a009f34503b3e66d137f 100644 --- a/pallets/identity/src/mock.rs +++ b/pallets/identity/src/mock.rs @@ -23,10 +23,9 @@ use frame_support::{ use frame_system as system; use sp_core::{Pair, H256}; use sp_keystore::{testing::MemoryKeystore, KeystoreExt}; -use sp_runtime::BuildStorage; use sp_runtime::{ traits::{BlakeTwo256, IdentityLookup}, - MultiSignature, MultiSigner, + BuildStorage, MultiSignature, MultiSigner, }; use sp_state_machine::BasicExternalities; use std::sync::Arc; diff --git a/pallets/identity/src/tests.rs b/pallets/identity/src/tests.rs index 63ae3b5c613e31a2f050d1885e9edd2db18707b1..9bc2205ebad0eba7b654884651743deca7a1d199 100644 --- a/pallets/identity/src/tests.rs +++ b/pallets/identity/src/tests.rs @@ -14,13 +14,10 @@ // You should have received a copy of the GNU Affero General Public License // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. -use crate::mock::*; -use crate::*; +use crate::{mock::*, *}; use codec::Encode; -use frame_support::dispatch::DispatchResultWithPostInfo; -use frame_support::{assert_noop, assert_ok}; -use sp_core::sr25519::Pair as KeyPair; -use sp_core::Pair; +use frame_support::{assert_noop, assert_ok, dispatch::DispatchResultWithPostInfo}; +use sp_core::{sr25519::Pair as KeyPair, Pair}; use sp_runtime::{MultiSignature, MultiSigner}; type IdtyVal = IdtyValue<u64, AccountId, ()>; diff --git a/pallets/membership/src/lib.rs b/pallets/membership/src/lib.rs index 4119fcb9cf47c947e3259011d8fdd75009786d08..714d4bb09d4b85510568cc7c199ae8c0652d7d97 100644 --- a/pallets/membership/src/lib.rs +++ b/pallets/membership/src/lib.rs @@ -31,13 +31,10 @@ pub mod weights; pub use pallet::*; pub use weights::WeightInfo; -use frame_support::pallet_prelude::Weight; -use frame_support::pallet_prelude::*; -use sp_membership::traits::*; -use sp_membership::MembershipData; +use frame_support::pallet_prelude::{Weight, *}; +use sp_membership::{traits::*, MembershipData}; use sp_runtime::traits::Zero; -use sp_std::collections::btree_map::BTreeMap; -use sp_std::prelude::*; +use sp_std::{collections::btree_map::BTreeMap, prelude::*}; #[cfg(feature = "runtime-benchmarks")] pub trait SetupBenchmark<IdtyId, AccountId> { diff --git a/pallets/membership/src/tests.rs b/pallets/membership/src/tests.rs index 4f22c32135af2cd04f215261307b0ad5278dfba2..c9b04c0a272eefad5b15774e1a145e3b63975681 100644 --- a/pallets/membership/src/tests.rs +++ b/pallets/membership/src/tests.rs @@ -14,13 +14,10 @@ // You should have received a copy of the GNU Affero General Public License // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. -use crate::mock::*; -use crate::MembershipRemovalReason; -use crate::{Error, Event}; +use crate::{mock::*, Error, Event, MembershipRemovalReason}; use frame_support::{assert_noop, assert_ok}; use maplit::btreemap; -use sp_membership::traits::*; -use sp_membership::MembershipData; +use sp_membership::{traits::*, MembershipData}; fn default_gen_conf() -> MembershipConfig { MembershipConfig { diff --git a/pallets/offences/src/mock.rs b/pallets/offences/src/mock.rs index 76fb2218f4e5c1482d8f058effd6353907690d0b..62cd5150d102674ff99dfd163777421ab846439d 100644 --- a/pallets/offences/src/mock.rs +++ b/pallets/offences/src/mock.rs @@ -16,8 +16,7 @@ #![cfg(test)] -use crate::Config; -use crate::{self as pallet_offences, SlashStrategy}; +use crate::{self as pallet_offences, Config, SlashStrategy}; use codec::Encode; use frame_support::{ parameter_types, @@ -25,10 +24,9 @@ use frame_support::{ weights::{constants::RocksDbWeight, Weight}, }; use sp_core::H256; -use sp_runtime::BuildStorage; use sp_runtime::{ traits::{BlakeTwo256, IdentityLookup}, - Perbill, + BuildStorage, Perbill, }; use sp_staking::{ offence::{Kind, OffenceDetails}, diff --git a/pallets/oneshot-account/src/benchmarking.rs b/pallets/oneshot-account/src/benchmarking.rs index ed38c4377d08d44f192c13e3255f5c8b8ca07846..1a936058713b0c0e98dd5bf780a2ff0cd81937ef 100644 --- a/pallets/oneshot-account/src/benchmarking.rs +++ b/pallets/oneshot-account/src/benchmarking.rs @@ -19,10 +19,8 @@ use super::*; -use frame_benchmarking::v2::*; -use frame_benchmarking::{account, whitelisted_caller}; -use frame_support::pallet_prelude::IsType; -use frame_support::traits::fungible::Mutate; +use frame_benchmarking::{account, v2::*, whitelisted_caller}; +use frame_support::{pallet_prelude::IsType, traits::fungible::Mutate}; use frame_system::RawOrigin; use pallet_balances::Pallet as Balances; diff --git a/pallets/oneshot-account/src/check_nonce.rs b/pallets/oneshot-account/src/check_nonce.rs index 83bd7494fe4c7ce9408d163b904352bcc104873e..3f365453196738d0edbf4c8e74223ae82282f137 100644 --- a/pallets/oneshot-account/src/check_nonce.rs +++ b/pallets/oneshot-account/src/check_nonce.rs @@ -17,8 +17,7 @@ use crate::Config; use codec::{Decode, Encode}; -use frame_support::dispatch::DispatchInfo; -use frame_support::traits::IsSubType; +use frame_support::{dispatch::DispatchInfo, traits::IsSubType}; //use frame_system::Config; use scale_info::TypeInfo; use sp_runtime::{ diff --git a/pallets/oneshot-account/src/lib.rs b/pallets/oneshot-account/src/lib.rs index a22e897a9546feceb2980a5f7bf89b2276925478..f1bff130b57d855fac2564fde450cf601bb6d416 100644 --- a/pallets/oneshot-account/src/lib.rs +++ b/pallets/oneshot-account/src/lib.rs @@ -28,12 +28,14 @@ pub use pallet::*; pub use types::*; pub use weights::WeightInfo; -use frame_support::pallet_prelude::*; -use frame_support::traits::fungible; -use frame_support::traits::{ - fungible::{Balanced, Credit, Inspect}, - tokens::{Fortitude, Precision, Preservation}, - Imbalance, IsSubType, +use frame_support::{ + pallet_prelude::*, + traits::{ + fungible, + fungible::{Balanced, Credit, Inspect}, + tokens::{Fortitude, Precision, Preservation}, + Imbalance, IsSubType, + }, }; use frame_system::pallet_prelude::*; use pallet_transaction_payment::OnChargeTransaction; diff --git a/pallets/provide-randomness/src/lib.rs b/pallets/provide-randomness/src/lib.rs index 608197496aa267c2bcd540d0d83bb45eb23479de..159be9f870da11d576e13598a0d3d062afafa674 100644 --- a/pallets/provide-randomness/src/lib.rs +++ b/pallets/provide-randomness/src/lib.rs @@ -23,10 +23,12 @@ mod benchmarking; mod types; pub mod weights; -use frame_support::pallet_prelude::Weight; -use frame_support::traits::{ - fungible::{self, Balanced, Credit}, - tokens::{Fortitude, Precision, Preservation}, +use frame_support::{ + pallet_prelude::Weight, + traits::{ + fungible::{self, Balanced, Credit}, + tokens::{Fortitude, Precision, Preservation}, + }, }; use sp_core::H256; use sp_std::prelude::*; @@ -49,8 +51,10 @@ impl OnFilledRandomness for () { #[frame_support::pallet] pub mod pallet { use super::*; - use frame_support::pallet_prelude::*; - use frame_support::traits::{OnUnbalanced, Randomness, StorageVersion}; + use frame_support::{ + pallet_prelude::*, + traits::{OnUnbalanced, Randomness, StorageVersion}, + }; use frame_system::pallet_prelude::*; use sp_core::H256; diff --git a/pallets/quota/src/benchmarking.rs b/pallets/quota/src/benchmarking.rs index 834268d9c014194c61a16a092e1fcd15c0f53e65..24dcd895e3065766c64472b68d960538e3c44dfe 100644 --- a/pallets/quota/src/benchmarking.rs +++ b/pallets/quota/src/benchmarking.rs @@ -17,8 +17,7 @@ #![cfg(feature = "runtime-benchmarks")] use super::*; -use frame_benchmarking::account; -use frame_benchmarking::v2::*; +use frame_benchmarking::{account, v2::*}; use sp_runtime::traits::One; fn assert_has_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) { diff --git a/pallets/quota/src/lib.rs b/pallets/quota/src/lib.rs index 7c25f1fe7ce9bbb6dfce165b4b0f1d81ec30b74d..79772ba8c58087cafa33e00c83086fa1386bbc94 100644 --- a/pallets/quota/src/lib.rs +++ b/pallets/quota/src/lib.rs @@ -29,13 +29,14 @@ mod tests; pub mod benchmarking; use crate::traits::*; -use frame_support::pallet_prelude::*; -use frame_support::traits::{Currency, ExistenceRequirement}; +use frame_support::{ + pallet_prelude::*, + traits::{Currency, ExistenceRequirement}, +}; use frame_system::pallet_prelude::*; pub use pallet::*; use sp_runtime::traits::Zero; -use sp_std::fmt::Debug; -use sp_std::vec::Vec; +use sp_std::{fmt::Debug, vec::Vec}; pub use weights::WeightInfo; #[frame_support::pallet] diff --git a/pallets/quota/src/mock.rs b/pallets/quota/src/mock.rs index 06aa1acbee1eff0cfaca74905e2f48093e18ba0c..fac5bad2089a38e39a560dc869ef792e6d586b4e 100644 --- a/pallets/quota/src/mock.rs +++ b/pallets/quota/src/mock.rs @@ -24,12 +24,9 @@ use frame_support::{ }; use frame_system as system; use sp_core::{Pair, H256}; -use sp_runtime::traits::IdentifyAccount; -use sp_runtime::traits::Verify; -use sp_runtime::BuildStorage; use sp_runtime::{ - traits::{BlakeTwo256, IdentityLookup}, - MultiSignature, MultiSigner, + traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify}, + BuildStorage, MultiSignature, MultiSigner, }; type BlockNumber = u64; diff --git a/pallets/quota/src/tests.rs b/pallets/quota/src/tests.rs index 81f65b8bfc62755e9694cc688052af98bcaddd21..40f7469286abeda7cad25e159294f1b132f18f84 100644 --- a/pallets/quota/src/tests.rs +++ b/pallets/quota/src/tests.rs @@ -14,8 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. -use crate::mock::*; -use crate::Weight; +use crate::{mock::*, Weight}; use frame_support::traits::Currency; use sp_core::Get; diff --git a/pallets/smith-members/src/lib.rs b/pallets/smith-members/src/lib.rs index 61edcd6f6e7b741523e9450b1de869cd12ee6ab1..883ed202de2797dea5737498640c1c695a598ceb 100644 --- a/pallets/smith-members/src/lib.rs +++ b/pallets/smith-members/src/lib.rs @@ -32,18 +32,15 @@ mod benchmarking; use codec::{Codec, Decode, Encode}; use duniter_primitives::Idty; -use frame_support::dispatch::DispatchResultWithPostInfo; -use frame_support::ensure; -use frame_support::pallet_prelude::Get; -use frame_support::pallet_prelude::RuntimeDebug; -use frame_support::pallet_prelude::Weight; -use frame_system::ensure_signed; -use frame_system::pallet_prelude::OriginFor; +use frame_support::{ + dispatch::DispatchResultWithPostInfo, + ensure, + pallet_prelude::{Get, RuntimeDebug, Weight}, +}; +use frame_system::{ensure_signed, pallet_prelude::OriginFor}; use scale_info::TypeInfo; -use sp_runtime::traits::AtLeast32BitUnsigned; -use sp_runtime::traits::IsMember; -use sp_std::fmt::Debug; -use sp_std::prelude::*; +use sp_runtime::traits::{AtLeast32BitUnsigned, IsMember}; +use sp_std::{fmt::Debug, prelude::*}; use crate::traits::OnSmithDelete; pub use crate::weights::WeightInfo; @@ -73,13 +70,10 @@ pub enum SmithStatus { #[frame_support::pallet] pub mod pallet { use super::*; - use frame_support::pallet_prelude::*; - use frame_support::traits::StorageVersion; + use frame_support::{pallet_prelude::*, traits::StorageVersion}; use pallet_authority_members::SessionIndex; use sp_runtime::traits::{Convert, IsMember}; - use sp_std::collections::btree_map::BTreeMap; - use sp_std::vec; - use sp_std::vec::Vec; + use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec}; const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); diff --git a/pallets/smith-members/src/mock.rs b/pallets/smith-members/src/mock.rs index 804b7d49f8f4e19833a9b9bc2771c5e13fa3e906..fa181f3bff4c0db2d0b9b0128923c66ac0dee793 100644 --- a/pallets/smith-members/src/mock.rs +++ b/pallets/smith-members/src/mock.rs @@ -17,16 +17,15 @@ #![cfg(test)] use crate::{self as pallet_smith_members}; -use frame_support::pallet_prelude::Hooks; use frame_support::{ + pallet_prelude::Hooks, parameter_types, traits::{ConstU32, ConstU64}, weights::{constants::RocksDbWeight, Weight}, }; use sp_core::H256; -use sp_runtime::traits::{ConvertInto, IsMember}; use sp_runtime::{ - traits::{BlakeTwo256, IdentityLookup}, + traits::{BlakeTwo256, ConvertInto, IdentityLookup, IsMember}, BuildStorage, Perbill, }; diff --git a/pallets/universal-dividend/src/lib.rs b/pallets/universal-dividend/src/lib.rs index 0b6360055d3cc99939dabc0b2b86ea691d429ed4..4609384d45c083b74d8f89b2cdf8066b3fe05419 100644 --- a/pallets/universal-dividend/src/lib.rs +++ b/pallets/universal-dividend/src/lib.rs @@ -33,9 +33,9 @@ pub use pallet::*; pub use types::*; pub use weights::WeightInfo; -use frame_support::traits::tokens::{Precision, Preservation}; use frame_support::traits::{ fungible::{self, Balanced, Mutate}, + tokens::{Precision, Preservation}, OnTimestampSet, }; use sp_arithmetic::{ @@ -47,8 +47,10 @@ use sp_runtime::traits::{Get, MaybeSerializeDeserialize, StaticLookup}; #[frame_support::pallet] pub mod pallet { use super::*; - use frame_support::pallet_prelude::*; - use frame_support::traits::{StorageVersion, StoredMap}; + use frame_support::{ + pallet_prelude::*, + traits::{StorageVersion, StoredMap}, + }; use frame_system::pallet_prelude::*; use sp_runtime::traits::Convert; diff --git a/pallets/upgrade-origin/src/lib.rs b/pallets/upgrade-origin/src/lib.rs index 15ebd1ae95c4aa18d78e2dd45d24f411646b3625..bcd8ad688774727ba61fbd5eaa1c2d0c0a38cc5e 100644 --- a/pallets/upgrade-origin/src/lib.rs +++ b/pallets/upgrade-origin/src/lib.rs @@ -24,8 +24,7 @@ pub use pallet::*; pub use weights::WeightInfo; use frame_support::{ - dispatch::GetDispatchInfo, - dispatch::PostDispatchInfo, + dispatch::{GetDispatchInfo, PostDispatchInfo}, traits::{IsSubType, UnfilteredDispatchable}, }; use sp_runtime::traits::Dispatchable; diff --git a/primitives/membership/src/lib.rs b/primitives/membership/src/lib.rs index 49756dda269a86543d0532ec07404781ec837aca..c98121711ad55d7e3504356af62b1e1b5539e6b6 100644 --- a/primitives/membership/src/lib.rs +++ b/primitives/membership/src/lib.rs @@ -22,8 +22,7 @@ pub mod traits; use codec::{Decode, Encode}; -use frame_support::pallet_prelude::RuntimeDebug; -use frame_support::pallet_prelude::Weight; +use frame_support::pallet_prelude::{RuntimeDebug, Weight}; use scale_info::TypeInfo; use serde::{Deserialize, Serialize}; diff --git a/resources/weight_analyzer/src/lib.rs b/resources/weight_analyzer/src/lib.rs index 83a43093c3e2225f951fb94d3a5a02a6b6f4e787..4f0682466744c85d5b02931d7045c42e9444870e 100644 --- a/resources/weight_analyzer/src/lib.rs +++ b/resources/weight_analyzer/src/lib.rs @@ -1,15 +1,16 @@ use convert_case::{Case, Casing}; use glob::glob; use serde::Serialize; -use std::collections::HashMap; -use std::ops::Div; -use std::path::Path; -use subweight_core::parse::overhead::Weight; -use subweight_core::parse::pallet::ChromaticExtrinsic; -use subweight_core::parse::pallet::ComponentRange; -use subweight_core::parse::storage::Weights; -use subweight_core::scope::Scope; -use subweight_core::term::Term; +use std::{collections::HashMap, ops::Div, path::Path}; +use subweight_core::{ + parse::{ + overhead::Weight, + pallet::{ChromaticExtrinsic, ComponentRange}, + storage::Weights, + }, + scope::Scope, + term::Term, +}; // Substrate default maximum weight of a block in nanoseconds. // Since the maximum block weight is one-third of the execution time, @@ -171,8 +172,7 @@ fn process( #[cfg(test)] mod tests { - use crate::analyze_weight; - use crate::MaxBlockWeight; + use crate::{analyze_weight, MaxBlockWeight}; use std::path::Path; #[test] fn should_works() { diff --git a/runtime/common/src/handlers.rs b/runtime/common/src/handlers.rs index c12f6d3d5759e12bf465168263a0bb16a5c47973..e8518fd1c94b721e336a8332c32d2bb64654c32c 100644 --- a/runtime/common/src/handlers.rs +++ b/runtime/common/src/handlers.rs @@ -14,10 +14,8 @@ // You should have received a copy of the GNU Affero General Public License // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. -use super::entities::*; -use super::{AccountId, IdtyIndex}; -use frame_support::pallet_prelude::Weight; -use frame_support::traits::UnfilteredDispatchable; +use super::{entities::*, AccountId, IdtyIndex}; +use frame_support::{pallet_prelude::Weight, traits::UnfilteredDispatchable}; use pallet_smith_members::SmithRemovalReason; /// OnNewSession handler for the runtime calling all the implementation diff --git a/runtime/g1/src/lib.rs b/runtime/g1/src/lib.rs index 20c078caabce898f8cef2f6ce5204d75577a00e8..a8c6ba1c0750e0574dc65f44b7b84d906e35022f 100644 --- a/runtime/g1/src/lib.rs +++ b/runtime/g1/src/lib.rs @@ -33,8 +33,7 @@ pub use common_runtime::{ constants::*, entities::*, handlers::*, AccountId, Address, Balance, BlockNumber, FullIdentificationOfImpl, GetCurrentEpochIndex, Hash, Header, IdtyIndex, Index, Signature, }; -use frame_support::traits::fungible::Balanced; -use frame_support::traits::Imbalance; +use frame_support::traits::{fungible::Balanced, Imbalance}; pub use frame_system::Call as SystemCall; pub use pallet_balances::Call as BalancesCall; pub use pallet_identity::{IdtyStatus, IdtyValue}; @@ -48,18 +47,16 @@ pub use sp_runtime::BuildStorage; pub use sp_runtime::{KeyTypeId, Perbill, Permill}; use common_runtime::IdtyNameValidatorImpl; -use frame_support::traits::Contains; -use frame_support::PalletId; +use frame_support::{traits::Contains, PalletId}; use frame_system::EnsureRoot; -use pallet_grandpa::fg_primitives; -use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList}; +use pallet_grandpa::{ + fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList, +}; use sp_api::impl_runtime_apis; use sp_core::OpaqueMetadata; -use sp_runtime::traits::{ - AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, One, OpaqueKeys, -}; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, + traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, One, OpaqueKeys}, transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, }; diff --git a/runtime/g1/src/parameters.rs b/runtime/g1/src/parameters.rs index 966982a799aa44218581c8d0a3c9d6fcbd654ce0..280a9f728368e0720ab660e7907f7d031d9c1b71 100644 --- a/runtime/g1/src/parameters.rs +++ b/runtime/g1/src/parameters.rs @@ -15,10 +15,8 @@ // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. use crate::*; -use common_runtime::constants::*; -use common_runtime::Moment; -use frame_support::parameter_types; -use frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND; +use common_runtime::{constants::*, Moment}; +use frame_support::{parameter_types, weights::constants::WEIGHT_REF_TIME_PER_SECOND}; use sp_runtime::transaction_validity::TransactionPriority; parameter_types! { diff --git a/runtime/gdev/src/lib.rs b/runtime/gdev/src/lib.rs index b7f63c3e3dbb0ac933dd633fd48aad388730fad3..f2955b84117d90bc6ce3b1778510de7e9f65ff0e 100644 --- a/runtime/gdev/src/lib.rs +++ b/runtime/gdev/src/lib.rs @@ -33,8 +33,7 @@ pub use common_runtime::{ constants::*, entities::*, handlers::*, AccountId, Address, Balance, BlockNumber, FullIdentificationOfImpl, GetCurrentEpochIndex, Hash, Header, IdtyIndex, Index, Signature, }; -use frame_support::traits::fungible::Balanced; -use frame_support::traits::Imbalance; +use frame_support::traits::{fungible::Balanced, Imbalance}; pub use frame_system::Call as SystemCall; pub use pallet_balances::Call as BalancesCall; pub use pallet_duniter_test_parameters::Parameters as GenesisParameters; @@ -48,18 +47,16 @@ pub use sp_runtime::BuildStorage; pub use sp_runtime::{KeyTypeId, Perbill, Permill}; use common_runtime::IdtyNameValidatorImpl; -use frame_support::traits::Contains; -use frame_support::PalletId; +use frame_support::{traits::Contains, PalletId}; use frame_system::EnsureRoot; -use pallet_grandpa::fg_primitives; -use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList}; +use pallet_grandpa::{ + fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList, +}; use sp_api::impl_runtime_apis; use sp_core::OpaqueMetadata; -use sp_runtime::traits::{ - AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, One, OpaqueKeys, -}; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, + traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, One, OpaqueKeys}, transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, }; diff --git a/runtime/gdev/src/parameters.rs b/runtime/gdev/src/parameters.rs index b78a2de4c5bbe536e094b24f2f534ff12c869033..6ff9b244d0b3e8fcee6b9c10fe5ccda747044fa7 100644 --- a/runtime/gdev/src/parameters.rs +++ b/runtime/gdev/src/parameters.rs @@ -16,9 +16,9 @@ use crate::*; use common_runtime::constants::*; -use frame_support::parameter_types; -use frame_support::traits::EitherOfDiverse; -use frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND; +use frame_support::{ + parameter_types, traits::EitherOfDiverse, weights::constants::WEIGHT_REF_TIME_PER_SECOND, +}; use sp_runtime::transaction_validity::TransactionPriority; parameter_types! { diff --git a/runtime/gdev/tests/balance_tests.rs b/runtime/gdev/tests/balance_tests.rs index 85c3b0ae374626dbeaae4eeded7bc03e63f5f84d..0d3955c5445073380e0871361fc7a603fcff2b1d 100644 --- a/runtime/gdev/tests/balance_tests.rs +++ b/runtime/gdev/tests/balance_tests.rs @@ -19,8 +19,7 @@ mod common; use common::*; -use frame_support::traits::StoredMap; -use frame_support::{assert_noop, assert_ok}; +use frame_support::{assert_noop, assert_ok, traits::StoredMap}; use gdev_runtime::*; use sp_core::Encode; use sp_keyring::AccountKeyring; diff --git a/runtime/gdev/tests/common/mod.rs b/runtime/gdev/tests/common/mod.rs index 95933e5250558e7b62f57f20be6a9584942ce5d6..109d30c453bc7393df26abb9aff7b2f666362d49 100644 --- a/runtime/gdev/tests/common/mod.rs +++ b/runtime/gdev/tests/common/mod.rs @@ -16,23 +16,20 @@ #![allow(dead_code, unused_imports)] -use common_runtime::constants::*; -use common_runtime::*; +use common_runtime::{constants::*, *}; use frame_support::traits::{OnFinalize, OnInitialize}; -use gdev_runtime::opaque::SessionKeys; -use gdev_runtime::*; +use gdev_runtime::{opaque::SessionKeys, *}; use pallet_authority_members::OnNewSession; use pallet_smith_members::SmithMeta; use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; -use sp_consensus_babe::{AuthorityId as BabeId, Slot}; -use sp_consensus_babe::{VrfInput, VrfProof}; +use sp_consensus_babe::{AuthorityId as BabeId, Slot, VrfInput, VrfProof}; use sp_consensus_grandpa::AuthorityId as GrandpaId; -use sp_core::crypto::IsWrappedBy; -use sp_core::sr25519; -use sp_core::{Encode, Pair, Public, H256}; +use sp_core::{crypto::IsWrappedBy, sr25519, Encode, Pair, Public, H256}; use sp_membership::MembershipData; -use sp_runtime::testing::{Digest, DigestItem}; -use sp_runtime::traits::{IdentifyAccount, Verify}; +use sp_runtime::{ + testing::{Digest, DigestItem}, + traits::{IdentifyAccount, Verify}, +}; use std::collections::BTreeMap; pub type AccountPublic = <Signature as Verify>::Signer; diff --git a/runtime/gdev/tests/integration_tests.rs b/runtime/gdev/tests/integration_tests.rs index 0b52fc7a627c0b623afc0ec8229ad4a80b2c844a..df3f1d85a48bb6a8a30b68785dbb572b267a2ae5 100644 --- a/runtime/gdev/tests/integration_tests.rs +++ b/runtime/gdev/tests/integration_tests.rs @@ -17,16 +17,16 @@ mod common; use common::*; -use frame_support::traits::StoredMap; -use frame_support::traits::{Get, PalletInfo, StorageInfo, StorageInfoTrait}; -use frame_support::{assert_err, assert_noop, assert_ok}; -use frame_support::{StorageHasher, Twox128}; +use frame_support::{ + assert_err, assert_noop, assert_ok, + traits::{Get, PalletInfo, StorageInfo, StorageInfoTrait, StoredMap}, + StorageHasher, Twox128, +}; use gdev_runtime::*; use pallet_identity::{RevocationPayload, REVOCATION_PAYLOAD_PREFIX}; use pallet_membership::MembershipRemovalReason; use pallet_smith_members::{SmithMeta, SmithStatus}; -use sp_core::Encode; -use sp_core::Pair; +use sp_core::{Encode, Pair}; use sp_keyring::AccountKeyring; use sp_runtime::MultiAddress; diff --git a/runtime/gdev/tests/offences_tests.rs b/runtime/gdev/tests/offences_tests.rs index fbfbb9d308d8882355eab1e5baee138bfc2e738c..67321d19dbe10a55ff2c131201b5fc7a521d1199 100644 --- a/runtime/gdev/tests/offences_tests.rs +++ b/runtime/gdev/tests/offences_tests.rs @@ -17,9 +17,10 @@ mod common; use common::*; -use frame_support::assert_ok; -use frame_support::traits::ValidatorSet; -use frame_support::traits::ValidatorSetWithIdentification; +use frame_support::{ + assert_ok, + traits::{ValidatorSet, ValidatorSetWithIdentification}, +}; use gdev_runtime::*; use pallet_im_online as im_online; use pallet_im_online::UnresponsivenessOffence; diff --git a/runtime/gdev/tests/xt_tests.rs b/runtime/gdev/tests/xt_tests.rs index bfa840a548da96752439d63f1b2c96b64036616a..9fa7f52599813bc3005681940268359b9df66557 100644 --- a/runtime/gdev/tests/xt_tests.rs +++ b/runtime/gdev/tests/xt_tests.rs @@ -20,15 +20,14 @@ mod common; use common::*; -use frame_support::assert_ok; -use frame_support::traits::OnIdle; -use frame_support::traits::StoredMap; +use frame_support::{ + assert_ok, + traits::{OnIdle, StoredMap}, +}; use gdev_runtime::*; -use sp_core::Encode; -use sp_core::Pair; +use sp_core::{Encode, Pair}; use sp_keyring::AccountKeyring; -use sp_runtime::generic::SignedPayload; -use sp_runtime::traits::Extrinsic; +use sp_runtime::{generic::SignedPayload, traits::Extrinsic}; /// get extrinsic for given call fn get_unchecked_extrinsic( diff --git a/runtime/gtest/src/lib.rs b/runtime/gtest/src/lib.rs index 9a39989c6218c9cb2d9505aa5698e1c294afa3b1..5d35e67fbc003f4bd6bfa7e3e1c19ac23da9e2d0 100644 --- a/runtime/gtest/src/lib.rs +++ b/runtime/gtest/src/lib.rs @@ -33,8 +33,7 @@ pub use common_runtime::{ constants::*, entities::*, handlers::*, AccountId, Address, Balance, BlockNumber, FullIdentificationOfImpl, GetCurrentEpochIndex, Hash, Header, IdtyIndex, Index, Signature, }; -use frame_support::traits::fungible::Balanced; -use frame_support::traits::Imbalance; +use frame_support::traits::{fungible::Balanced, Imbalance}; pub use frame_system::Call as SystemCall; pub use pallet_balances::Call as BalancesCall; pub use pallet_im_online::sr25519::AuthorityId as ImOnlineId; @@ -47,18 +46,16 @@ pub use sp_runtime::BuildStorage; pub use sp_runtime::{KeyTypeId, Perbill, Permill}; use common_runtime::IdtyNameValidatorImpl; -use frame_support::traits::Contains; -use frame_support::PalletId; +use frame_support::{traits::Contains, PalletId}; use frame_system::EnsureRoot; -use pallet_grandpa::fg_primitives; -use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList}; +use pallet_grandpa::{ + fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList, +}; use sp_api::impl_runtime_apis; use sp_core::OpaqueMetadata; -use sp_runtime::traits::{ - AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, One, OpaqueKeys, -}; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, + traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, One, OpaqueKeys}, transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, }; diff --git a/runtime/gtest/src/parameters.rs b/runtime/gtest/src/parameters.rs index c183502c805c94d4473fe226801b89ab57109e7c..c32a78c250b3942c16c0e8627e24d2477f7d24b7 100644 --- a/runtime/gtest/src/parameters.rs +++ b/runtime/gtest/src/parameters.rs @@ -16,8 +16,7 @@ use crate::*; use common_runtime::constants::*; -use frame_support::parameter_types; -use frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND; +use frame_support::{parameter_types, weights::constants::WEIGHT_REF_TIME_PER_SECOND}; use sp_runtime::transaction_validity::TransactionPriority; parameter_types! { diff --git a/rustfmt.toml b/rustfmt.toml index b7ac0b7277d257f2401ec6ef04d6b8ef88ba6c5c..f2abd12533cc86c456bcebc3989330f39983ef2a 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1 +1,2 @@ +imports_granularity = "Crate" reorder_impl_items = true diff --git a/xtask/src/gen_doc.rs b/xtask/src/gen_doc.rs index 9b94cca95a7edd0b81e8a5cc1e7f115a50a63333..88d99dc61baa91ef18b8cd83734ffc6233fcfa86 100644 --- a/xtask/src/gen_doc.rs +++ b/xtask/src/gen_doc.rs @@ -19,17 +19,15 @@ use codec::Decode; use core::hash::Hash; use scale_info::form::PortableForm; use serde::Serialize; -use std::collections::HashMap; -use std::path::Path; -use std::process::Command; use std::{ + collections::HashMap, fs::File, io::{Read, Write}, + path::Path, + process::Command, }; use tera::Tera; -use weightanalyzer::analyze_weight; -use weightanalyzer::MaxBlockWeight; -use weightanalyzer::WeightInfo; +use weightanalyzer::{analyze_weight, MaxBlockWeight, WeightInfo}; fn rename_key<K, V>(h: &mut HashMap<K, V>, old_key: &K, new_key: K) where diff --git a/xtask/src/main.rs b/xtask/src/main.rs index c6b201b9d06d1b0af24dc9771305d9b51cb6d56f..d22c237fecee09ba3b523858bd9070e8dfd78013 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -21,9 +21,11 @@ mod release_runtime; use anyhow::{Context, Result}; use clap::Parser; -use std::io::{BufReader, BufWriter}; -use std::path::{Path, PathBuf}; -use std::process::Command; +use std::{ + io::{BufReader, BufWriter}, + path::{Path, PathBuf}, + process::Command, +}; const MIN_RUST_VERSION: &str = "1.58.0";