Browse Source

refactoring: simplify

iorveth 4 years ago
parent
commit
7e2ba829fd

+ 1 - 2
runtime-modules/content-directory/src/permissions/class.rs

@@ -25,8 +25,7 @@ pub struct ClassPermissions<T: Trait> {
 
 impl<T: Trait> core::fmt::Debug for ClassPermissions<T> {
     fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
-        write!(formatter, "ClassPermissions {{ any_member {:?}, entity_creation_blocked {:?}, all_entity_property_values_locked {:?}, maintainers {:?} }}",
-         self.any_member, self.entity_creation_blocked, self.all_entity_property_values_locked, self.maintainers)
+        write!(formatter, "ClassPermissions {:?}", self)
     }
 }
 

+ 3 - 49
runtime-modules/content-directory/src/schema/input.rs

@@ -10,7 +10,7 @@ pub enum InputPropertyValue<T: Trait> {
 
 impl<T: Trait> core::fmt::Debug for InputPropertyValue<T> {
     fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
-        write!(formatter, "InputPropertyValue {{{:?}}}", self)
+        write!(formatter, "InputPropertyValue {:?}", self)
     }
 }
 
@@ -81,22 +81,7 @@ pub enum InputValue<T: Trait> {
 
 impl<T: Trait> core::fmt::Debug for InputValue<T> {
     fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
-        match self {
-            InputValue::Bool(value) => write!(formatter, "InputValue {{ Bool {:?}}}", value),
-            InputValue::Uint16(value) => write!(formatter, "InputValue {{ Uint16 {:?}}}", value),
-            InputValue::Uint32(value) => write!(formatter, "InputValue {{ Uint32 {:?}}}", value),
-            InputValue::Uint64(value) => write!(formatter, "InputValue {{ Uint64 {:?}}}", value),
-            InputValue::Int16(value) => write!(formatter, "InputValue {{ Int16 {:?}}}", value),
-            InputValue::Int32(value) => write!(formatter, "InputValue {{ Int32 {:?}}}", value),
-            InputValue::Int64(value) => write!(formatter, "InputValue {{ Int64 {:?}}}", value),
-            InputValue::Text(value) => write!(formatter, "InputValue {{ Text {:?}}}", value),
-            InputValue::TextToHash(value) => {
-                write!(formatter, "InputValue {{ TextToHash {:?}}}", value)
-            }
-            InputValue::Reference(value) => {
-                write!(formatter, "InputValue {{ Reference {:?}}}", value)
-            }
-        }
+        write!(formatter, "InputValue {:?}", self)
     }
 }
 
@@ -136,38 +121,7 @@ pub enum VecInputValue<T: Trait> {
 
 impl<T: Trait> core::fmt::Debug for VecInputValue<T> {
     fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
-        match self {
-            VecInputValue::Bool(vec_value) => {
-                write!(formatter, "VecInputValue {{ Bool {:?}}}", vec_value)
-            }
-            VecInputValue::Uint16(vec_value) => {
-                write!(formatter, "VecInputValue {{ Uint16 {:?}}}", vec_value)
-            }
-            VecInputValue::Uint32(vec_value) => {
-                write!(formatter, "VecInputValue {{ Uint32 {:?}}}", vec_value)
-            }
-            VecInputValue::Uint64(vec_value) => {
-                write!(formatter, "VecInputValue {{ Uint64 {:?}}}", vec_value)
-            }
-            VecInputValue::Int16(vec_value) => {
-                write!(formatter, "VecInputValue {{ Int16 {:?}}}", vec_value)
-            }
-            VecInputValue::Int32(vec_value) => {
-                write!(formatter, "VecInputValue {{ Int32 {:?}}}", vec_value)
-            }
-            VecInputValue::Int64(vec_value) => {
-                write!(formatter, "VecInputValue {{ Int64 {:?}}}", vec_value)
-            }
-            VecInputValue::TextToHash(vec_value) => {
-                write!(formatter, "VecInputValue {{ TextToHash {:?}}}", vec_value)
-            }
-            VecInputValue::Text(vec_value) => {
-                write!(formatter, "VecInputValue {{ Text {:?}}}", vec_value)
-            }
-            VecInputValue::Reference(vec_value) => {
-                write!(formatter, "VecInputValue {{ Reference {:?}}}", vec_value)
-            }
-        }
+        write!(formatter, "VecInputValue {:?}", self)
     }
 }