Browse Source

Remove redundant traits from content directory trait associated types

iorveth 4 years ago
parent
commit
33a8c890d4

+ 2 - 2
Cargo.lock

@@ -3949,9 +3949,9 @@ dependencies = [
 
 [[package]]
 name = "parity-scale-codec-derive"
-version = "1.2.0"
+version = "1.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a0ec292e92e8ec7c58e576adacc1e3f399c597c8f263c42f18420abe58e7245"
+checksum = "198db82bb1c18fc00176004462dd809b2a6d851669550aa17af6dacd21ae0c14"
 dependencies = [
  "proc-macro-crate",
  "proc-macro2",

+ 1 - 1
runtime-modules/content-directory/src/helpers.rs

@@ -185,7 +185,7 @@ pub struct InputValidationLengthConstraint {
 
 impl InputValidationLengthConstraint {
     /// Create new `InputValidationLengthConstraint` constraint
-    pub fn new(min: u16, max_min_diff: u16) -> Self {
+    pub const fn new(min: u16, max_min_diff: u16) -> Self {
         Self { min, max_min_diff }
     }
 

+ 0 - 7
runtime-modules/content-directory/src/lib.rs

@@ -135,7 +135,6 @@ pub use operations::*;
 pub use permissions::*;
 pub use schema::*;
 
-use core::fmt::Debug;
 use core::hash::Hash;
 use core::ops::AddAssign;
 
@@ -175,8 +174,6 @@ pub trait Trait: system::Trait + ActorAuthenticator + Clone {
         + Default
         + Copy
         + Clone
-        + One
-        + Zero
         + MaybeSerializeDeserialize
         + Eq
         + PartialEq
@@ -191,9 +188,7 @@ pub trait Trait: system::Trait + ActorAuthenticator + Clone {
         + Default
         + Copy
         + Clone
-        + One
         + Hash
-        + Zero
         + MaybeSerializeDeserialize
         + Eq
         + PartialEq
@@ -208,8 +203,6 @@ pub trait Trait: system::Trait + ActorAuthenticator + Clone {
         + Copy
         + Clone
         + Hash
-        + One
-        + Zero
         + MaybeSerializeDeserialize
         + Eq
         + PartialEq

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

@@ -69,7 +69,6 @@ pub enum OperationType<T: Trait> {
 }
 
 impl<T: Trait> core::fmt::Debug for OperationType<T> {
-    #[cfg(feature = "std")]
     fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
         write!(formatter, "OperationType {:?}", self)
     }

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

@@ -51,7 +51,6 @@ pub trait ActorAuthenticator: system::Trait {
         + Member
         + BaseArithmetic
         + Codec
-        + One
         + Default
         + Copy
         + Clone
@@ -122,7 +121,6 @@ impl<T: Trait> Default for Actor<T> {
 }
 
 impl<T: Trait> core::fmt::Debug for Actor<T> {
-    #[cfg(feature = "std")]
     fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
         write!(formatter, "Actor {:?}", self)
     }

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

@@ -24,7 +24,6 @@ pub struct ClassPermissions<T: Trait> {
 }
 
 impl<T: Trait> core::fmt::Debug for ClassPermissions<T> {
-    #[cfg(feature = "std")]
     fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
         write!(formatter, "ClassPermissions {:?}", self)
     }

+ 0 - 1
runtime-modules/content-directory/src/permissions/entity.rs

@@ -27,7 +27,6 @@ impl<T: Trait> Default for EntityController<T> {
 }
 
 impl<T: Trait> core::fmt::Debug for EntityController<T> {
-    #[cfg(feature = "std")]
     fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
         write!(formatter, "EntityController {:?}", self)
     }

+ 0 - 1
runtime-modules/content-directory/src/schema.rs

@@ -287,7 +287,6 @@ impl<T: Trait> Default for Property<T> {
 }
 
 impl<T: Trait> core::fmt::Debug for Property<T> {
-    #[cfg(feature = "std")]
     fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
         write!(formatter, "Property {:?}", self)
     }

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

@@ -9,7 +9,6 @@ pub enum InputPropertyValue<T: Trait> {
 }
 
 impl<T: Trait> core::fmt::Debug for InputPropertyValue<T> {
-    #[cfg(feature = "std")]
     fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
         write!(formatter, "InputPropertyValue {:?}", self)
     }
@@ -81,8 +80,7 @@ pub enum InputValue<T: Trait> {
 }
 
 impl<T: Trait> core::fmt::Debug for InputValue<T> {
-    #[cfg(feature = "std")]
-    fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
+    fn fmt(&self, formatter: &mut core::fmt::Formatter<'_>) -> sp_std::fmt::Result {
         write!(formatter, "InputValue {:?}", self)
     }
 }

+ 4 - 3
runtime/src/lib.rs

@@ -382,15 +382,15 @@ impl content_directory::ActorAuthenticator for Runtime {
     type MemberId = u64;
     type CuratorGroupId = u64;
 
-    fn is_lead() -> bool {
+    fn is_lead(account_id: &AccountId) -> bool {
         true
     }
 
-    fn is_curator(curator_id: &Self::CuratorId, account_id: &Self::AccountId) -> bool {
+    fn is_curator(curator_id: &Self::CuratorId, account_id: &AccountId) -> bool {
         true
     }
 
-    fn is_member(member_id: &Self::MemberId, account_id: &Self::AccountId) -> bool {
+    fn is_member(member_id: &Self::MemberId, account_id: &AccountId) -> bool {
         true
     }
 }
@@ -679,6 +679,7 @@ construct_runtime!(
         RecurringRewards: recurring_rewards::{Module, Call, Storage},
         Hiring: hiring::{Module, Call, Storage},
         ContentWorkingGroup: content_wg::{Module, Call, Storage, Event<T>, Config<T>},
+        ContentDirectory: content_directory::{Module, Call, Storage, Event<T>, Config<T>},
         // --- Storage
         DataObjectTypeRegistry: data_object_type_registry::{Module, Call, Storage, Event<T>, Config<T>},
         DataDirectory: data_directory::{Module, Call, Storage, Event<T>},