From c1ac7baae9e62f9dfe9e53e5d41cad7adf133b07 Mon Sep 17 00:00:00 2001 From: Chris Tsang Date: Sun, 8 Aug 2021 16:13:27 +0800 Subject: [PATCH] cargo fmt --- sea-orm-codegen/src/entity/column.rs | 2 +- src/entity/base_entity.rs | 2 +- tests/common/setup/schema.rs | 42 +++++++++++++++++++++++----- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/sea-orm-codegen/src/entity/column.rs b/sea-orm-codegen/src/entity/column.rs index 5634bdd8..9a6cf4dc 100644 --- a/sea-orm-codegen/src/entity/column.rs +++ b/sea-orm-codegen/src/entity/column.rs @@ -88,7 +88,7 @@ impl Column { ColumnType::Custom(s) => { let s = s.to_string(); quote! { ColumnType::Custom(#s.to_owned()).def() } - }, + } _ => unimplemented!(), }; if !self.not_null { diff --git a/src/entity/base_entity.rs b/src/entity/base_entity.rs index 9c2dc776..95d5603e 100644 --- a/src/entity/base_entity.rs +++ b/src/entity/base_entity.rs @@ -4,8 +4,8 @@ use crate::{ RelationTrait, RelationType, Select, Update, UpdateMany, UpdateOne, }; use sea_query::{Iden, IntoValueTuple}; -use std::fmt::Debug; pub use sea_strum::IntoEnumIterator as Iterable; +use std::fmt::Debug; pub trait IdenStatic: Iden + Copy + Debug + 'static { fn as_str(&self) -> &str; diff --git a/tests/common/setup/schema.rs b/tests/common/setup/schema.rs index 5542c618..4eba40ab 100644 --- a/tests/common/setup/schema.rs +++ b/tests/common/setup/schema.rs @@ -20,7 +20,11 @@ pub async fn create_bakery_table(db: &DbConn) -> Result { .primary_key(), ) .col(ColumnDef::new(bakery::Column::Name).string().not_null()) - .col(ColumnDef::new(bakery::Column::ProfitMargin).double().not_null()) + .col( + ColumnDef::new(bakery::Column::ProfitMargin) + .double() + .not_null(), + ) .to_owned(); create_table(db, &stmt).await @@ -37,7 +41,11 @@ pub async fn create_baker_table(db: &DbConn) -> Result { .primary_key(), ) .col(ColumnDef::new(baker::Column::Name).string().not_null()) - .col(ColumnDef::new(baker::Column::ContactDetails).json().not_null()) + .col( + ColumnDef::new(baker::Column::ContactDetails) + .json() + .not_null(), + ) .col(ColumnDef::new(baker::Column::BakeryId).integer()) .foreign_key( ForeignKey::create() @@ -81,7 +89,11 @@ pub async fn create_order_table(db: &DbConn) -> Result { .auto_increment() .primary_key(), ) - .col(ColumnDef::new(order::Column::Total).decimal_len(19, 4).not_null()) + .col( + ColumnDef::new(order::Column::Total) + .decimal_len(19, 4) + .not_null(), + ) .col(ColumnDef::new(order::Column::BakeryId).integer().not_null()) .col( ColumnDef::new(order::Column::CustomerId) @@ -125,8 +137,16 @@ pub async fn create_lineitem_table(db: &DbConn) -> Result { .auto_increment() .primary_key(), ) - .col(ColumnDef::new(lineitem::Column::Price).decimal_len(19, 4).not_null()) - .col(ColumnDef::new(lineitem::Column::Quantity).integer().not_null()) + .col( + ColumnDef::new(lineitem::Column::Price) + .decimal_len(19, 4) + .not_null(), + ) + .col( + ColumnDef::new(lineitem::Column::Quantity) + .integer() + .not_null(), + ) .col( ColumnDef::new(lineitem::Column::OrderId) .integer() @@ -210,7 +230,11 @@ pub async fn create_cake_table(db: &DbConn) -> Result { .primary_key(), ) .col(ColumnDef::new(cake::Column::Name).string().not_null()) - .col(ColumnDef::new(cake::Column::Price).decimal_len(19, 4).not_null()) + .col( + ColumnDef::new(cake::Column::Price) + .decimal_len(19, 4) + .not_null(), + ) .col(ColumnDef::new(cake::Column::BakeryId).integer()) .foreign_key( ForeignKey::create() @@ -220,7 +244,11 @@ pub async fn create_cake_table(db: &DbConn) -> Result { .on_delete(ForeignKeyAction::Cascade) .on_update(ForeignKeyAction::Cascade), ) - .col(ColumnDef::new(cake::Column::GlutenFree).boolean().not_null()) + .col( + ColumnDef::new(cake::Column::GlutenFree) + .boolean() + .not_null(), + ) .col(ColumnDef::new(cake::Column::Serial).uuid().not_null()) .to_owned();