Browse Source

content-directory: fix infinite recursion in core::fmt::Debug impl

Mokhtar Naamani 4 years ago
parent
commit
8d0aed3139

+ 11 - 1
runtime-modules/content-directory/src/operations.rs

@@ -70,7 +70,17 @@ pub enum OperationType<T: Trait> {
 
 impl<T: Trait> core::fmt::Debug for OperationType<T> {
     fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
-        write!(formatter, "OperationType {:?}", self)
+        match self {
+            OperationType::CreateEntity(_) => {
+                write!(formatter, "OperationType::CreateEntity")
+            }
+            OperationType::AddSchemaSupportToEntity(_) => {
+                write!(formatter, "OperationType::AddSchemaSupportToEntity")
+            }
+            OperationType::UpdatePropertyValues(_) => {
+                write!(formatter, "OperationType::UpdatePropertyValues")
+            }
+        }
     }
 }
 

+ 2 - 2
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")
     }
 }
 
@@ -81,7 +81,7 @@ pub enum InputValue<T: Trait> {
 
 impl<T: Trait> core::fmt::Debug for InputValue<T> {
     fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> sp_std::fmt::Result {
-        write!(formatter, "InputValue {:?}", self)
+        write!(formatter, "InputValue")
     }
 }