Skip to content

Commit

Permalink
clippy and fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ProbablyClem committed Jun 11, 2023
1 parent f1c491c commit f28b626
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 39 deletions.
2 changes: 1 addition & 1 deletion sea-orm-cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ pub enum GenerateSubcommands {
help = "The datetime crate to use for generating entities."
)]
date_time_crate: DateTimeCrate,

#[arg(
long,
default_value_t,
Expand Down
5 changes: 3 additions & 2 deletions sea-orm-cli/src/commands/generate.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use sea_orm_codegen::{
DateTimeCrate as CodegenDateTimeCrate, DecimalCrate as CodegenDecimalCrate, EntityTransformer, EntityWriterContext, OutputFile,
WithSerde};
DateTimeCrate as CodegenDateTimeCrate, DecimalCrate as CodegenDecimalCrate, EntityTransformer,
EntityWriterContext, OutputFile, WithSerde,
};
use std::{error::Error, fs, io::Write, path::Path, process::Command, str::FromStr};
use tracing_subscriber::{prelude::*, EnvFilter};
use url::Url;
Expand Down
1 change: 1 addition & 0 deletions sea-orm-codegen/src/entity/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ impl EntityWriter {
})
}

#[allow(clippy::too_many_arguments)]
pub fn gen_model_struct(
entity: &Entity,
with_serde: &WithSerde,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use sea_orm::entity::prelude::*;
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub user_id: Option<i32> ,
pub user_id: Option<i32>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
Expand All @@ -15,7 +15,7 @@ pub enum Relation {
from = "Column::UserId",
to = "super::users::Column::Id",
on_update = "NoAction",
on_delete = "NoAction",
on_delete = "NoAction"
)]
Users,
#[sea_orm(has_many = "super::users_saved_bills::Entity")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ pub enum Relation {
from = "Column::BillId",
to = "super::bills::Column::Id",
on_update = "Cascade",
on_delete = "Cascade",
on_delete = "Cascade"
)]
Bills,
#[sea_orm(
belongs_to = "super::users::Entity",
from = "Column::UserId",
to = "super::users::Column::Id",
on_update = "Cascade",
on_delete = "Cascade",
on_delete = "Cascade"
)]
Users,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ pub enum Relation {
from = "Column::BillId",
to = "super::bills::Column::Id",
on_update = "Cascade",
on_delete = "Cascade",
on_delete = "Cascade"
)]
Bills,
#[sea_orm(
belongs_to = "super::users::Entity",
from = "Column::UserId",
to = "super::users::Column::Id",
on_update = "Cascade",
on_delete = "Cascade",
on_delete = "Cascade"
)]
Users,
}
Expand Down
4 changes: 2 additions & 2 deletions sea-orm-codegen/src/tests_cfg/many_to_many/bills.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use sea_orm::entity::prelude::*;
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub user_id: Option<i32> ,
pub user_id: Option<i32>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
Expand All @@ -15,7 +15,7 @@ pub enum Relation {
from = "Column::UserId",
to = "super::users::Column::Id",
on_update = "NoAction",
on_delete = "NoAction",
on_delete = "NoAction"
)]
Users,
#[sea_orm(has_many = "super::users_votes::Entity")]
Expand Down
4 changes: 2 additions & 2 deletions sea-orm-codegen/src/tests_cfg/many_to_many/users_votes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ pub enum Relation {
from = "Column::BillId",
to = "super::bills::Column::Id",
on_update = "Cascade",
on_delete = "Cascade",
on_delete = "Cascade"
)]
Bills,
#[sea_orm(
belongs_to = "super::users::Entity",
from = "Column::UserId",
to = "super::users::Column::Id",
on_update = "Cascade",
on_delete = "Cascade",
on_delete = "Cascade"
)]
Users,
}
Expand Down
4 changes: 2 additions & 2 deletions sea-orm-codegen/src/tests_cfg/many_to_many_multiple/bills.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use sea_orm::entity::prelude::*;
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub user_id: Option<i32> ,
pub user_id: Option<i32>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
Expand All @@ -15,7 +15,7 @@ pub enum Relation {
from = "Column::UserId",
to = "super::users::Column::Id",
on_update = "NoAction",
on_delete = "NoAction",
on_delete = "NoAction"
)]
Users,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ pub struct Model {
pub user_id: i32,
#[sea_orm(primary_key, auto_increment = false)]
pub bill_id: i32,
pub user_idd: Option<i32> ,
pub bill_idd: Option<i32> ,
pub user_idd: Option<i32>,
pub bill_idd: Option<i32>,
pub vote: bool,
}

Expand All @@ -17,25 +17,25 @@ pub enum Relation {
#[sea_orm(
belongs_to = "super::bills::Entity",
from = "Column::BillIdd",
to = "super::bills::Column::Id",
to = "super::bills::Column::Id"
)]
Bills2,
#[sea_orm(
belongs_to = "super::bills::Entity",
from = "Column::BillId",
to = "super::bills::Column::Id",
to = "super::bills::Column::Id"
)]
Bills1,
#[sea_orm(
belongs_to = "super::users::Entity",
from = "Column::UserIdd",
to = "super::users::Column::Id",
to = "super::users::Column::Id"
)]
Users2,
#[sea_orm(
belongs_to = "super::users::Entity",
from = "Column::UserId",
to = "super::users::Column::Id",
to = "super::users::Column::Id"
)]
Users1,
}
Expand Down
8 changes: 2 additions & 6 deletions sea-orm-codegen/src/tests_cfg/self_referencing/bills.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@ use sea_orm::entity::prelude::*;
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub self_id: Option<i32> ,
pub self_id: Option<i32>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "Entity",
from = "Column::SelfId",
to = "Column::Id",
)]
#[sea_orm(belongs_to = "Entity", from = "Column::SelfId", to = "Column::Id")]
SelfRef,
}

Expand Down
16 changes: 4 additions & 12 deletions sea-orm-codegen/src/tests_cfg/self_referencing/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,15 @@ use sea_orm::entity::prelude::*;
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub self_id: Option<i32> ,
pub self_idd: Option<i32> ,
pub self_id: Option<i32>,
pub self_idd: Option<i32>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "Entity",
from = "Column::SelfId",
to = "Column::Id",
)]
#[sea_orm(belongs_to = "Entity", from = "Column::SelfId", to = "Column::Id")]
SelfRef2,
#[sea_orm(
belongs_to = "Entity",
from = "Column::SelfIdd",
to = "Column::Id",
)]
#[sea_orm(belongs_to = "Entity", from = "Column::SelfIdd", to = "Column::Id")]
SelfRef1,
}

Expand Down

0 comments on commit f28b626

Please sign in to comment.