From 870ca3ffb0a783eaa2c46aadbdcb42e6963e2064 Mon Sep 17 00:00:00 2001 From: Charles Chege Date: Sat, 30 Oct 2021 12:00:07 +0300 Subject: [PATCH] Run fmt --all --- sea-orm-macros/src/lib.rs | 22 +++++++++++----------- src/entity/active_model.rs | 5 +++-- src/entity/base_entity.rs | 3 +-- src/entity/mod.rs | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sea-orm-macros/src/lib.rs b/sea-orm-macros/src/lib.rs index 87ac07d0..b770f1c8 100644 --- a/sea-orm-macros/src/lib.rs +++ b/sea-orm-macros/src/lib.rs @@ -12,8 +12,8 @@ mod util; /// ``` /// use sea_orm::entity::prelude::*; /// -///#[derive(Copy, Clone, Default, Debug, DeriveEntity)] -///pub struct Entity; +/// #[derive(Copy, Clone, Default, Debug, DeriveEntity)] +/// pub struct Entity; /// ``` #[proc_macro_derive(DeriveEntity, attributes(sea_orm))] pub fn derive_entity(input: TokenStream) -> TokenStream { @@ -150,13 +150,11 @@ pub fn derive_model(input: TokenStream) -> TokenStream { /// ### Usage /// /// ``` -/// /// #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] /// pub struct Model { /// pub id: i32, /// pub name: String, /// } -/// /// ``` #[proc_macro_derive(DeriveActiveModel, attributes(sea_orm))] pub fn derive_active_model(input: TokenStream) -> TokenStream { @@ -183,7 +181,9 @@ pub fn derive_into_active_model(input: TokenStream) -> TokenStream { /// ``` /// use sea_orm::entity::prelude::*; /// -/// #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, DeriveActiveModelBehavior,)] +/// #[derive( +/// Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, DeriveActiveModelBehavior, +/// )] /// pub struct Model { /// pub id: i32, /// pub name: String, @@ -203,11 +203,11 @@ pub fn derive_active_model_behavior(input: TokenStream) -> TokenStream { /// ### Usage /// /// ``` -/// #[derive(Debug, FromQueryResult)] -/// struct SelectResult { -/// name: String, -/// num_of_fruits: i32, -/// } +/// #[derive(Debug, FromQueryResult)] +/// struct SelectResult { +/// name: String, +/// num_of_fruits: i32, +/// } /// ``` #[proc_macro_derive(FromQueryResult)] pub fn derive_from_query_result(input: TokenStream) -> TokenStream { @@ -224,7 +224,7 @@ pub fn derive_from_query_result(input: TokenStream) -> TokenStream { /// ``` /// #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] /// pub enum Relation { -/// #[sea_orm( +/// #[sea_orm( /// belongs_to = "super::cake::Entity", /// from = "Column::CakeId", /// to = "super::cake::Column::Id" diff --git a/src/entity/active_model.rs b/src/entity/active_model.rs index 57e2569d..af1fc339 100644 --- a/src/entity/active_model.rs +++ b/src/entity/active_model.rs @@ -73,7 +73,7 @@ where /// #[derive(Clone, Debug, PartialEq, DeriveActiveModel)] /// pub struct Model { /// pub id: i32, -/// pub name: Option , +/// pub name: Option, /// } /// ``` #[async_trait] @@ -211,6 +211,8 @@ pub trait ActiveModelTrait: Clone + Debug { /// /// ### Example /// ``` +/// use sea_orm::entity::prelude::*; +/// /// /// Derive the active /// #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] /// pub struct Model { @@ -220,7 +222,6 @@ pub trait ActiveModelTrait: Clone + Debug { /// } /// ``` /// impl ActiveModelBehavior for ActiveModel {} -/// #[allow(unused_variables)] pub trait ActiveModelBehavior: ActiveModelTrait { /// Create a new ActiveModel with default values. Also used by `Default::default()`. diff --git a/src/entity/base_entity.rs b/src/entity/base_entity.rs index 0fe504dd..c03199d7 100644 --- a/src/entity/base_entity.rs +++ b/src/entity/base_entity.rs @@ -37,7 +37,6 @@ pub trait EntityName: IdenStatic + Default { } } -/// FIXME Add docs for manual impl /// An Entity implementing `EntityTrait` represents a table in a database. /// /// This trait provides an API for you to inspect it's properties @@ -79,7 +78,7 @@ pub trait EntityTrait: EntityName { RelationBuilder::from_rel(RelationType::HasOne, R::to().rev(), true) } - /// Chech if the Entity has many relations + /// Check if the Entity has many relations fn has_many(_: R) -> RelationBuilder where R: EntityTrait + Related, diff --git a/src/entity/mod.rs b/src/entity/mod.rs index 8b4fe6f8..08280326 100644 --- a/src/entity/mod.rs +++ b/src/entity/mod.rs @@ -40,7 +40,7 @@ //! #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] //! pub struct Model { //! pub id: i32, -//! pub name: Option , +//! pub name: Option, //! } //! //! // Use the [DeriveColumn] to create a Column for an the table called Entity