Switch to new proc-macro crate for implementing traits for tuples (#3598)

* Switch to new proc-macro crate for implementing traits for tuples

* Switch back to stable `Cargo.lock` format

* Reduce tuple number to match rusts default implementation
This commit is contained in:
Bastian Köcher
2019-09-11 19:10:02 +02:00
committed by GitHub
parent 433d752831
commit d136b8eb81
16 changed files with 139 additions and 306 deletions
+2 -19
View File
@@ -112,7 +112,7 @@ use sr_primitives::{
use primitives::storage::well_known_keys;
use support::{
storage, decl_module, decl_event, decl_storage, StorageDoubleMap, StorageValue, StorageMap,
Parameter, for_each_tuple, traits::{Contains, Get}, decl_error,
Parameter, traits::{Contains, Get}, decl_error,
};
use safe_mix::TripletMix;
use codec::{Encode, Decode};
@@ -126,29 +126,12 @@ use primitives::ChangesTrieConfiguration;
pub mod offchain;
/// Handler for when a new account has been created.
#[impl_trait_for_tuples::impl_for_tuples(30)]
pub trait OnNewAccount<AccountId> {
/// A new account `who` has been registered.
fn on_new_account(who: &AccountId);
}
macro_rules! impl_on_new_account {
() => (
impl<AccountId> OnNewAccount<AccountId> for () {
fn on_new_account(_: &AccountId) {}
}
);
( $($t:ident)* ) => {
impl<AccountId, $($t: OnNewAccount<AccountId>),*> OnNewAccount<AccountId> for ($($t,)*) {
fn on_new_account(who: &AccountId) {
$($t::on_new_account(who);)*
}
}
}
}
for_each_tuple!(impl_on_new_account);
/// Determiner to say whether a given account is unused.
pub trait IsDeadAccount<AccountId> {
/// Is the given account dead?