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
@@ -96,7 +96,7 @@ use codec::Encode;
use codec::Decode;
#[cfg(feature = "std")]
use inherents::ProvideInherentData;
use support::{StorageValue, Parameter, decl_storage, decl_module, for_each_tuple};
use support::{StorageValue, Parameter, decl_storage, decl_module};
use support::traits::{Time, Get};
use sr_primitives::traits::{
SimpleArithmetic, Zero, SaturatedConversion, Scale
@@ -183,28 +183,11 @@ impl ProvideInherentData for InherentDataProvider {
}
/// A trait which is called when the timestamp is set.
#[impl_trait_for_tuples::impl_for_tuples(30)]
pub trait OnTimestampSet<Moment> {
fn on_timestamp_set(moment: Moment);
}
macro_rules! impl_timestamp_set {
() => (
impl<Moment> OnTimestampSet<Moment> for () {
fn on_timestamp_set(_: Moment) {}
}
);
( $($t:ident)* ) => {
impl<Moment: Copy, $($t: OnTimestampSet<Moment>),*> OnTimestampSet<Moment> for ($($t,)*) {
fn on_timestamp_set(moment: Moment) {
$($t::on_timestamp_set(moment);)*
}
}
}
}
for_each_tuple!(impl_timestamp_set);
/// The module configuration trait
pub trait Trait: system::Trait {
/// Type used for expressing timestamp.