From 05ccb1b644acddc93d41add8c008774f21bc2112 Mon Sep 17 00:00:00 2001 From: Chris Tsang Date: Sun, 6 Jun 2021 16:06:05 +0800 Subject: [PATCH] Tweak ActiveModelBehavior --- sea-orm-macros/src/derives/active_model_behavior.rs | 4 +--- src/entity/active_model.rs | 2 -- src/tests_cfg/cake.rs | 4 +--- src/tests_cfg/cake_filling.rs | 4 +--- src/tests_cfg/filling.rs | 4 +--- src/tests_cfg/fruit.rs | 4 +--- 6 files changed, 5 insertions(+), 17 deletions(-) diff --git a/sea-orm-macros/src/derives/active_model_behavior.rs b/sea-orm-macros/src/derives/active_model_behavior.rs index 746f57e2..6b62b8d8 100644 --- a/sea-orm-macros/src/derives/active_model_behavior.rs +++ b/sea-orm-macros/src/derives/active_model_behavior.rs @@ -4,8 +4,6 @@ use syn::Data; pub fn expand_derive_active_model_behavior(_ident: Ident, _data: Data) -> syn::Result { Ok(quote!( - impl sea_orm::ActiveModelBehavior for ActiveModel { - type Entity = Entity; - } + impl sea_orm::ActiveModelBehavior for ActiveModel {} )) } diff --git a/src/entity/active_model.rs b/src/entity/active_model.rs index 6b7ee656..ab0eeff8 100644 --- a/src/entity/active_model.rs +++ b/src/entity/active_model.rs @@ -62,8 +62,6 @@ pub trait ActiveModelTrait: Clone + Debug { /// Behaviors for users to override pub trait ActiveModelBehavior: ActiveModelTrait { - type Entity: EntityTrait; - /// Create a new ActiveModel with default values. Also used by `Default::default()`. fn new() -> Self { ::default() diff --git a/src/tests_cfg/cake.rs b/src/tests_cfg/cake.rs index 2d3c3de2..bb7c2130 100644 --- a/src/tests_cfg/cake.rs +++ b/src/tests_cfg/cake.rs @@ -80,6 +80,4 @@ impl Model { } } -impl ActiveModelBehavior for ActiveModel { - type Entity = Entity; -} +impl ActiveModelBehavior for ActiveModel {} diff --git a/src/tests_cfg/cake_filling.rs b/src/tests_cfg/cake_filling.rs index f5de2391..7534634f 100644 --- a/src/tests_cfg/cake_filling.rs +++ b/src/tests_cfg/cake_filling.rs @@ -60,6 +60,4 @@ impl RelationTrait for Relation { } } -impl ActiveModelBehavior for ActiveModel { - type Entity = Entity; -} +impl ActiveModelBehavior for ActiveModel {} diff --git a/src/tests_cfg/filling.rs b/src/tests_cfg/filling.rs index 11efff5b..34db602b 100644 --- a/src/tests_cfg/filling.rs +++ b/src/tests_cfg/filling.rs @@ -63,6 +63,4 @@ impl Model { } } -impl ActiveModelBehavior for ActiveModel { - type Entity = Entity; -} +impl ActiveModelBehavior for ActiveModel {} diff --git a/src/tests_cfg/fruit.rs b/src/tests_cfg/fruit.rs index b69f445b..4475945c 100644 --- a/src/tests_cfg/fruit.rs +++ b/src/tests_cfg/fruit.rs @@ -50,6 +50,4 @@ impl RelationTrait for Relation { } } -impl ActiveModelBehavior for ActiveModel { - type Entity = Entity; -} +impl ActiveModelBehavior for ActiveModel {}