From 1c4a2b39d6b9df6c0a11c94b1b2b7d6366a11249 Mon Sep 17 00:00:00 2001 From: Daniel Shiposha Date: Thu, 12 May 2022 16:02:57 +0000 Subject: [PATCH] Use Error::from when needed --- --- a/pallets/common/src/lib.rs +++ b/pallets/common/src/lib.rs @@ -674,7 +674,7 @@ let mut collection_properties = up_data_structs::CollectionProperties::get(); collection_properties .try_set_from_iter(data.properties.into_iter().map(|p| (p.key, p.value))) - .map_err(|e| -> Error { e.into() })?; + .map_err(>::from)?; CollectionProperties::::insert(id, collection_properties); @@ -685,7 +685,7 @@ .into_iter() .map(|property| (property.key, property.permission)), ) - .map_err(|e| -> Error { e.into() })?; + .map_err(>::from)?; CollectionPropertyPermissions::::insert(id, token_props_permissions); @@ -765,7 +765,7 @@ let property = property.clone(); properties.try_set(property.key, property.value) }) - .map_err(|e| -> Error { e.into() })?; + .map_err(>::from)?; Self::deposit_event(Event::CollectionPropertySet(collection.id, property.key)); @@ -794,7 +794,7 @@ CollectionProperties::::try_mutate(collection.id, |properties| { properties.remove(&property_key) }) - .map_err(|e| -> Error { e.into() })?; + .map_err(>::from)?; Self::deposit_event(Event::CollectionPropertyDeleted( collection.id, @@ -836,7 +836,7 @@ let property_permission = property_permission.clone(); permissions.try_set(property_permission.key, property_permission.permission) }) - .map_err(|e| -> Error { e.into() })?; + .map_err(>::from)?; Self::deposit_event(Event::PropertyPermissionSet( collection.id, --- a/pallets/nonfungible/src/lib.rs +++ b/pallets/nonfungible/src/lib.rs @@ -271,7 +271,7 @@ let property = property.clone(); properties.try_set(property.key, property.value) }) - .map_err(|e| -> CommonError { e.into() })?; + .map_err(>::from)?; >::deposit_event(CommonEvent::TokenPropertySet( collection.id, @@ -306,7 +306,7 @@ >::try_mutate((collection.id, token_id), |properties| { properties.remove(&property_key) }) - .map_err(|e| -> CommonError { e.into() })?; + .map_err(>::from)?; >::deposit_event(CommonEvent::TokenPropertyDeleted( collection.id, -- gitstuff