mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 16:57:58 +00:00
Run cargo fmt on the whole code base (#9394)
* Run cargo fmt on the whole code base * Second run * Add CI check * Fix compilation * More unnecessary braces * Handle weights * Use --all * Use correct attributes... * Fix UI tests * AHHHHHHHHH * 🤦 * Docs * Fix compilation * 🤷 * Please stop * 🤦 x 2 * More * make rustfmt.toml consistent with polkadot Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
@@ -23,15 +23,19 @@ impl SomeAssociation for u64 {
|
||||
}
|
||||
|
||||
mod pallet_old {
|
||||
use super::SomeAssociation;
|
||||
use frame_support::{
|
||||
decl_storage, decl_error, decl_event, decl_module, weights::Weight, traits::Get, Parameter
|
||||
decl_error, decl_event, decl_module, decl_storage, traits::Get, weights::Weight, Parameter,
|
||||
};
|
||||
use frame_system::ensure_root;
|
||||
use super::SomeAssociation;
|
||||
|
||||
pub trait Config: frame_system::Config {
|
||||
type SomeConst: Get<Self::Balance>;
|
||||
type Balance: Parameter + codec::HasCompact + From<u32> + Into<Weight> + Default
|
||||
type Balance: Parameter
|
||||
+ codec::HasCompact
|
||||
+ From<u32>
|
||||
+ Into<Weight>
|
||||
+ Default
|
||||
+ SomeAssociation;
|
||||
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
|
||||
}
|
||||
@@ -50,7 +54,10 @@ mod pallet_old {
|
||||
}
|
||||
|
||||
decl_event!(
|
||||
pub enum Event<T> where Balance = <T as Config>::Balance {
|
||||
pub enum Event<T>
|
||||
where
|
||||
Balance = <T as Config>::Balance,
|
||||
{
|
||||
/// Dummy event, just here so there's a generic type that's used.
|
||||
Dummy(Balance),
|
||||
}
|
||||
@@ -93,13 +100,17 @@ mod pallet_old {
|
||||
pub mod pallet {
|
||||
use super::SomeAssociation;
|
||||
use frame_support::pallet_prelude::*;
|
||||
use frame_system::pallet_prelude::*;
|
||||
use frame_system::ensure_root;
|
||||
use frame_system::{ensure_root, pallet_prelude::*};
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config: frame_system::Config {
|
||||
type Balance: Parameter + codec::HasCompact + From<u32> + Into<Weight> + Default
|
||||
+ MaybeSerializeDeserialize + SomeAssociation;
|
||||
type Balance: Parameter
|
||||
+ codec::HasCompact
|
||||
+ From<u32>
|
||||
+ Into<Weight>
|
||||
+ Default
|
||||
+ MaybeSerializeDeserialize
|
||||
+ SomeAssociation;
|
||||
#[pallet::constant]
|
||||
type SomeConst: Get<Self::Balance>;
|
||||
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
|
||||
@@ -125,7 +136,7 @@ pub mod pallet {
|
||||
#[pallet::weight(<T::Balance as Into<Weight>>::into(new_value.clone()))]
|
||||
pub fn set_dummy(
|
||||
origin: OriginFor<T>,
|
||||
#[pallet::compact] new_value: T::Balance
|
||||
#[pallet::compact] new_value: T::Balance,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
ensure_root(origin)?;
|
||||
|
||||
@@ -157,13 +168,22 @@ pub mod pallet {
|
||||
#[pallet::storage]
|
||||
type Bar<T: Config> = StorageMap<_, Blake2_128Concat, T::AccountId, T::Balance, ValueQuery>;
|
||||
|
||||
#[pallet::type_value] pub fn OnFooEmpty<T: Config>() -> T::Balance { 3.into() }
|
||||
#[pallet::type_value]
|
||||
pub fn OnFooEmpty<T: Config>() -> T::Balance {
|
||||
3.into()
|
||||
}
|
||||
#[pallet::storage]
|
||||
type Foo<T: Config> = StorageValue<_, T::Balance, ValueQuery, OnFooEmpty<T>>;
|
||||
|
||||
#[pallet::storage]
|
||||
type Double<T: Config> = StorageDoubleMap<
|
||||
_, Blake2_128Concat, u32, Twox64Concat, u64, <T::Balance as SomeAssociation>::A, ValueQuery
|
||||
_,
|
||||
Blake2_128Concat,
|
||||
u32,
|
||||
Twox64Concat,
|
||||
u64,
|
||||
<T::Balance as SomeAssociation>::A,
|
||||
ValueQuery,
|
||||
>;
|
||||
|
||||
#[pallet::genesis_config]
|
||||
@@ -257,9 +277,7 @@ frame_support::construct_runtime!(
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::Runtime;
|
||||
use super::pallet;
|
||||
use super::pallet_old;
|
||||
use super::{pallet, pallet_old, Runtime};
|
||||
use codec::{Decode, Encode};
|
||||
|
||||
#[test]
|
||||
@@ -284,14 +302,16 @@ mod test {
|
||||
assert_eq!(
|
||||
pallet_old::Event::<Runtime>::decode(
|
||||
&mut &pallet::Event::<Runtime>::Dummy(10).encode()[..]
|
||||
).unwrap(),
|
||||
)
|
||||
.unwrap(),
|
||||
pallet_old::Event::<Runtime>::Dummy(10),
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
pallet_old::Call::<Runtime>::decode(
|
||||
&mut &pallet::Call::<Runtime>::set_dummy(10).encode()[..]
|
||||
).unwrap(),
|
||||
)
|
||||
.unwrap(),
|
||||
pallet_old::Call::<Runtime>::set_dummy(10),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user