From 67f10b919505e323f1035353414349acc2b5ce84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Mon, 9 Mar 2020 12:39:49 +0100 Subject: [PATCH] Improve debug implementation of `CheckNonce` and `CheckEra` (#5156) --- substrate/frame/system/src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs index f1286beac4..bd9e61b51a 100644 --- a/substrate/frame/system/src/lib.rs +++ b/substrate/frame/system/src/lib.rs @@ -1257,7 +1257,7 @@ impl CheckNonce { impl Debug for CheckNonce { #[cfg(feature = "std")] fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { - self.0.fmt(f) + write!(f, "CheckNonce({})", self.0) } #[cfg(not(feature = "std"))] @@ -1336,19 +1336,19 @@ impl IsDeadAccount for Module { /// Check for transaction mortality. #[derive(Encode, Decode, Clone, Eq, PartialEq)] -pub struct CheckEra((Era, sp_std::marker::PhantomData)); +pub struct CheckEra(Era, sp_std::marker::PhantomData); impl CheckEra { /// utility constructor. Used only in client/factory code. pub fn from(era: Era) -> Self { - Self((era, sp_std::marker::PhantomData)) + Self(era, sp_std::marker::PhantomData) } } impl Debug for CheckEra { #[cfg(feature = "std")] fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { - self.0.fmt(f) + write!(f, "CheckEra({:?})", self.0) } #[cfg(not(feature = "std"))] @@ -1373,7 +1373,7 @@ impl SignedExtension for CheckEra { _len: usize, ) -> TransactionValidity { let current_u64 = >::block_number().saturated_into::(); - let valid_till = (self.0).0.death(current_u64); + let valid_till = self.0.death(current_u64); Ok(ValidTransaction { longevity: valid_till.saturating_sub(current_u64), ..Default::default() @@ -1382,7 +1382,7 @@ impl SignedExtension for CheckEra { fn additional_signed(&self) -> Result { let current_u64 = >::block_number().saturated_into::(); - let n = (self.0).0.birth(current_u64).saturated_into::(); + let n = self.0.birth(current_u64).saturated_into::(); if !>::contains_key(n) { Err(InvalidTransaction::AncientBirthBlock.into()) } else {