Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removed autoimpl in impl_outer_log
  • Loading branch information
svyatonik committed Sep 4, 2018
commit e9dcb0a24ab11c74a7057117c32004f0294bd562
12 changes: 11 additions & 1 deletion demo/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,17 @@ impl_outer_event! {

impl_outer_log! {
pub enum Log for Concrete {
consensus(AuthoritiesChange => consensus::AuthoritiesChange<SessionKey> => as_authorities_change)
consensus
}
}

impl DigestItem for Log {
type AuthoritiesChange = consensus::AuthoritiesChange<SessionKey>;

fn as_authorities_change(&self) -> Option<&Self::AuthoritiesChange> {
match *self {
Log::consensus(ref item) => item.as_authorities_change(),
}
}
}

Expand Down
Binary file not shown.
Binary file not shown.
17 changes: 3 additions & 14 deletions substrate/runtime-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ macro_rules! impl_outer_event {

#[macro_export]
macro_rules! impl_outer_log {
($(#[$attr:meta])* pub enum $name:ident for $trait:ident { $( $module:ident($( $log_type_name:ident => $log_type:ty => $as_log:ident ),*) ),* }) => {

($(#[$attr:meta])* pub enum $name:ident for $trait:ident { $( $module:ident ),* }) => {
// Workaround for https://github.com/rust-lang/rust/issues/26925 . Remove when sorted.
#[derive(Clone, PartialEq, Eq, Encode, Decode)]
#[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))]
Expand All @@ -132,18 +133,6 @@ macro_rules! impl_outer_log {
$name::$module(x)
}
}

impl DigestItem for $name {
$(
type $log_type_name = $log_type;

fn $as_log(&self) -> Option<&$log_type> {
match *self {
$name::$module(ref item) => item.$as_log(),
}
}
)*
}
)*
}
};
}
Binary file not shown.
Binary file not shown.