From 6543207062dec5e3fa3544c6dd8e3239f3637edd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 25 Jan 2019 11:22:04 +0100 Subject: [PATCH] Fix inconsistency between `CheckInherentsResult::new()/default()` (#1561) --- substrate/core/inherents/src/lib.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/substrate/core/inherents/src/lib.rs b/substrate/core/inherents/src/lib.rs index 9bf9272e57..14b213b51d 100644 --- a/substrate/core/inherents/src/lib.rs +++ b/substrate/core/inherents/src/lib.rs @@ -59,9 +59,7 @@ pub struct InherentData { impl InherentData { /// Create a new instance. pub fn new() -> Self { - Self { - data: Default::default(), - } + Self::default() } /// Put data for an inherent into the internal storage. @@ -153,7 +151,7 @@ impl codec::Decode for InherentData { /// /// When a fatal error occurres, all other errors are removed and the implementation needs to /// abbort checking inherents. -#[derive(Encode, Decode, Clone, Default)] +#[derive(Encode, Decode, Clone)] pub struct CheckInherentsResult { /// Did the check succeed? okay: bool, @@ -163,15 +161,21 @@ pub struct CheckInherentsResult { errors: InherentData, } -impl CheckInherentsResult { - /// Create a new instance. - pub fn new() -> Self { +impl Default for CheckInherentsResult { + fn default() -> Self { Self { okay: true, errors: InherentData::new(), fatal_error: false, } } +} + +impl CheckInherentsResult { + /// Create a new instance. + pub fn new() -> Self { + Self::default() + } /// Put an error into the result. ///