diff --git a/build-tools/rustclippy.sh b/build-tools/rustclippy.sh new file mode 100644 index 00000000..dcc7506e --- /dev/null +++ b/build-tools/rustclippy.sh @@ -0,0 +1,25 @@ +#!/bin/bash +set -e +if [ -d ./build-tools ]; then + targets=( + "Cargo.toml" + "sea-orm-cli/Cargo.toml" + "sea-orm-codegen/Cargo.toml" + "sea-orm-macros/Cargo.toml" + "sea-orm-migration/Cargo.toml" + "sea-orm-rocket/Cargo.toml" + ) + + for target in "${targets[@]}"; do + echo "cargo clippy --manifest-path ${target} --fix --allow-dirty --allow-staged" + cargo clippy --manifest-path "${target}" --fix --allow-dirty --allow-staged + done + + examples=(`find examples -type f -name 'Cargo.toml'`) + for example in "${examples[@]}"; do + echo "cargo clippy --manifest-path ${example} --fix --allow-dirty --allow-staged" + cargo clippy --manifest-path "${example}" --fix --allow-dirty --allow-staged + done +else + echo "Please execute this script from the repository root." +fi diff --git a/examples/actix3_example/entity/src/post.rs b/examples/actix3_example/entity/src/post.rs index 37a99c2f..62cde830 100644 --- a/examples/actix3_example/entity/src/post.rs +++ b/examples/actix3_example/entity/src/post.rs @@ -1,7 +1,7 @@ use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Deserialize, Serialize)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Deserialize, Serialize)] #[sea_orm(table_name = "posts")] pub struct Model { #[sea_orm(primary_key)] diff --git a/examples/actix_example/entity/src/post.rs b/examples/actix_example/entity/src/post.rs index 37a99c2f..62cde830 100644 --- a/examples/actix_example/entity/src/post.rs +++ b/examples/actix_example/entity/src/post.rs @@ -1,7 +1,7 @@ use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Deserialize, Serialize)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Deserialize, Serialize)] #[sea_orm(table_name = "posts")] pub struct Model { #[sea_orm(primary_key)] diff --git a/examples/axum_example/entity/src/post.rs b/examples/axum_example/entity/src/post.rs index 3bb4d6a3..76d78196 100644 --- a/examples/axum_example/entity/src/post.rs +++ b/examples/axum_example/entity/src/post.rs @@ -3,7 +3,7 @@ use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)] #[sea_orm(table_name = "posts")] pub struct Model { #[sea_orm(primary_key)] diff --git a/examples/basic/src/example_cake.rs b/examples/basic/src/example_cake.rs index 0e13ffcd..b3364df8 100644 --- a/examples/basic/src/example_cake.rs +++ b/examples/basic/src/example_cake.rs @@ -1,6 +1,6 @@ use sea_orm::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "cake")] pub struct Model { #[sea_orm(primary_key)] diff --git a/examples/basic/src/example_cake_filling.rs b/examples/basic/src/example_cake_filling.rs index 4fa188bc..1ce203f6 100644 --- a/examples/basic/src/example_cake_filling.rs +++ b/examples/basic/src/example_cake_filling.rs @@ -9,7 +9,7 @@ impl EntityName for Entity { } } -#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveModel, DeriveActiveModel)] pub struct Model { pub cake_id: i32, pub filling_id: i32, diff --git a/examples/basic/src/example_filling.rs b/examples/basic/src/example_filling.rs index 2a39a7de..363f31db 100644 --- a/examples/basic/src/example_filling.rs +++ b/examples/basic/src/example_filling.rs @@ -9,7 +9,7 @@ impl EntityName for Entity { } } -#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveModel, DeriveActiveModel)] pub struct Model { pub id: i32, pub name: String, diff --git a/examples/basic/src/example_fruit.rs b/examples/basic/src/example_fruit.rs index 8802e707..0850a298 100644 --- a/examples/basic/src/example_fruit.rs +++ b/examples/basic/src/example_fruit.rs @@ -9,7 +9,7 @@ impl EntityName for Entity { } } -#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveModel, DeriveActiveModel)] pub struct Model { pub id: i32, pub name: String, diff --git a/examples/basic/src/operation.rs b/examples/basic/src/operation.rs index b5104095..037103f2 100644 --- a/examples/basic/src/operation.rs +++ b/examples/basic/src/operation.rs @@ -71,7 +71,7 @@ mod form { use sea_orm::entity::prelude::*; #[derive( - Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, DeriveActiveModelBehavior, + Clone, Debug, PartialEq, Eq, DeriveModel, DeriveActiveModel, DeriveActiveModelBehavior, )] pub struct Model { pub id: i32, diff --git a/examples/basic/src/select.rs b/examples/basic/src/select.rs index ce26f9e2..947a2511 100644 --- a/examples/basic/src/select.rs +++ b/examples/basic/src/select.rs @@ -28,15 +28,15 @@ pub async fn all_about_select(db: &DbConn) -> Result<(), DbErr> { println!("===== =====\n"); - find_all_stream(&db).await.unwrap(); + find_all_stream(db).await.unwrap(); println!("===== =====\n"); - find_first_page(&db).await.unwrap(); + find_first_page(db).await.unwrap(); println!("===== =====\n"); - find_num_pages(&db).await.unwrap(); + find_num_pages(db).await.unwrap(); Ok(()) } @@ -180,15 +180,15 @@ async fn find_many_to_many(db: &DbConn) -> Result<(), DbErr> { } async fn all_about_select_json(db: &DbConn) -> Result<(), DbErr> { - find_all_json(&db).await?; + find_all_json(db).await?; println!("===== =====\n"); - find_together_json(&db).await?; + find_together_json(db).await?; println!("===== =====\n"); - count_fruits_by_cake_json(&db).await?; + count_fruits_by_cake_json(db).await?; Ok(()) } diff --git a/examples/graphql_example/entity/src/note.rs b/examples/graphql_example/entity/src/note.rs index d1d30750..46f0c49b 100644 --- a/examples/graphql_example/entity/src/note.rs +++ b/examples/graphql_example/entity/src/note.rs @@ -2,7 +2,7 @@ use async_graphql::*; use sea_orm::{entity::prelude::*, DeleteMany}; use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize, SimpleObject)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize, SimpleObject)] #[sea_orm(table_name = "notes")] #[graphql(concrete(name = "Note", params()))] pub struct Model { diff --git a/examples/graphql_example/migration/src/main.rs b/examples/graphql_example/migration/src/main.rs index 3e249b20..37517f25 100644 --- a/examples/graphql_example/migration/src/main.rs +++ b/examples/graphql_example/migration/src/main.rs @@ -1,5 +1,4 @@ use sea_orm_migration::prelude::*; -use std::path::PathBuf; #[cfg(debug_assertions)] use dotenv::dotenv; diff --git a/examples/jsonrpsee_example/entity/src/post.rs b/examples/jsonrpsee_example/entity/src/post.rs index 719fa118..fbc002d1 100644 --- a/examples/jsonrpsee_example/entity/src/post.rs +++ b/examples/jsonrpsee_example/entity/src/post.rs @@ -1,7 +1,7 @@ use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Deserialize, Serialize)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Deserialize, Serialize)] #[sea_orm(table_name = "posts")] pub struct Model { #[sea_orm(primary_key)] diff --git a/examples/poem_example/entity/src/post.rs b/examples/poem_example/entity/src/post.rs index 37a99c2f..62cde830 100644 --- a/examples/poem_example/entity/src/post.rs +++ b/examples/poem_example/entity/src/post.rs @@ -1,7 +1,7 @@ use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Deserialize, Serialize)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Deserialize, Serialize)] #[sea_orm(table_name = "posts")] pub struct Model { #[sea_orm(primary_key)] diff --git a/examples/rocket_example/entity/src/post.rs b/examples/rocket_example/entity/src/post.rs index fb4c2929..ecf3f98f 100644 --- a/examples/rocket_example/entity/src/post.rs +++ b/examples/rocket_example/entity/src/post.rs @@ -1,7 +1,7 @@ use rocket::serde::{Deserialize, Serialize}; use sea_orm::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Deserialize, Serialize, FromForm)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Deserialize, Serialize, FromForm)] #[serde(crate = "rocket::serde")] #[sea_orm(table_name = "posts")] pub struct Model { diff --git a/examples/salvo_example/entity/src/post.rs b/examples/salvo_example/entity/src/post.rs index 37a99c2f..62cde830 100644 --- a/examples/salvo_example/entity/src/post.rs +++ b/examples/salvo_example/entity/src/post.rs @@ -1,7 +1,7 @@ use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Deserialize, Serialize)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Deserialize, Serialize)] #[sea_orm(table_name = "posts")] pub struct Model { #[sea_orm(primary_key)] diff --git a/examples/tonic_example/entity/src/post.rs b/examples/tonic_example/entity/src/post.rs index 37a99c2f..62cde830 100644 --- a/examples/tonic_example/entity/src/post.rs +++ b/examples/tonic_example/entity/src/post.rs @@ -1,7 +1,7 @@ use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Deserialize, Serialize)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Deserialize, Serialize)] #[sea_orm(table_name = "posts")] pub struct Model { #[sea_orm(primary_key)] diff --git a/sea-orm-cli/src/cli.rs b/sea-orm-cli/src/cli.rs index fadc63fe..68f32ef8 100644 --- a/sea-orm-cli/src/cli.rs +++ b/sea-orm-cli/src/cli.rs @@ -10,7 +10,7 @@ pub struct Cli { pub command: Commands, } -#[derive(Subcommand, PartialEq, Debug)] +#[derive(Subcommand, PartialEq, Eq, Debug)] pub enum Commands { #[clap(about = "Codegen related commands")] #[clap(arg_required_else_help = true)] @@ -35,7 +35,7 @@ pub enum Commands { }, } -#[derive(Subcommand, PartialEq, Debug)] +#[derive(Subcommand, PartialEq, Eq, Debug)] pub enum MigrateSubcommands { #[clap(about = "Initialize migration directory")] Init, @@ -81,7 +81,7 @@ pub enum MigrateSubcommands { }, } -#[derive(Subcommand, PartialEq, Debug)] +#[derive(Subcommand, PartialEq, Eq, Debug)] pub enum GenerateSubcommands { #[clap(about = "Generate entity")] #[clap(arg_required_else_help = true)] @@ -190,7 +190,7 @@ pub enum GenerateSubcommands { }, } -#[derive(ArgEnum, Copy, Clone, Debug, PartialEq)] +#[derive(ArgEnum, Copy, Clone, Debug, PartialEq, Eq)] pub enum DateTimeCrate { Chrono, Time, diff --git a/sea-orm-codegen/src/entity/writer.rs b/sea-orm-codegen/src/entity/writer.rs index 8227fa48..19722e18 100644 --- a/sea-orm-codegen/src/entity/writer.rs +++ b/sea-orm-codegen/src/entity/writer.rs @@ -21,7 +21,7 @@ pub struct OutputFile { pub content: String, } -#[derive(PartialEq, Debug)] +#[derive(PartialEq, Eq, Debug)] pub enum WithSerde { None, Serialize, diff --git a/sea-orm-migration/src/migrator.rs b/sea-orm-migration/src/migrator.rs index 698045ab..5239d759 100644 --- a/sea-orm-migration/src/migrator.rs +++ b/sea-orm-migration/src/migrator.rs @@ -12,7 +12,7 @@ use sea_schema::{mysql::MySql, postgres::Postgres, probe::SchemaProbe, sqlite::S use super::{seaql_migrations, MigrationTrait, SchemaManager}; -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] /// Status of migration pub enum MigrationStatus { /// Not yet applied diff --git a/sea-orm-migration/src/seaql_migrations.rs b/sea-orm-migration/src/seaql_migrations.rs index 43f044ec..9926ea9c 100644 --- a/sea-orm-migration/src/seaql_migrations.rs +++ b/sea-orm-migration/src/seaql_migrations.rs @@ -1,6 +1,6 @@ use sea_orm::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "seaql_migrations")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] diff --git a/sea-orm-migration/tests/migrator/m20220118_000003_seed_cake_table.rs b/sea-orm-migration/tests/migrator/m20220118_000003_seed_cake_table.rs index 8a31ec4f..92a0a6da 100644 --- a/sea-orm-migration/tests/migrator/m20220118_000003_seed_cake_table.rs +++ b/sea-orm-migration/tests/migrator/m20220118_000003_seed_cake_table.rs @@ -34,7 +34,7 @@ impl MigrationTrait for Migration { mod cake { use sea_orm_migration::sea_orm::entity::prelude::*; - #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] + #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "cake")] pub struct Model { #[sea_orm(primary_key)] diff --git a/sea-orm-rocket/lib/src/config.rs b/sea-orm-rocket/lib/src/config.rs index fb898e7b..4a48aa39 100644 --- a/sea-orm-rocket/lib/src/config.rs +++ b/sea-orm-rocket/lib/src/config.rs @@ -47,7 +47,7 @@ use rocket::serde::{Deserialize, Serialize}; /// For general information on configuration in Rocket, see [`rocket::config`]. /// For higher-level details on configuring a database, see the [crate-level /// docs](crate#configuration). -#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(crate = "rocket::serde")] pub struct Config { /// Database-specific connection and configuration URL. diff --git a/src/database/db_connection.rs b/src/database/db_connection.rs index 177b24f8..ac4fd7e6 100644 --- a/src/database/db_connection.rs +++ b/src/database/db_connection.rs @@ -38,7 +38,7 @@ pub type DbConn = DatabaseConnection; /// The type of database backend for real world databases. /// This is enabled by feature flags as specified in the crate documentation -#[derive(Debug, Copy, Clone, PartialEq)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum DatabaseBackend { /// A MySQL backend MySql, diff --git a/src/database/mock.rs b/src/database/mock.rs index ac9fe1a0..7af7cdb5 100644 --- a/src/database/mock.rs +++ b/src/database/mock.rs @@ -349,7 +349,7 @@ mod tests { }; use pretty_assertions::assert_eq; - #[derive(Debug, PartialEq)] + #[derive(Debug, PartialEq, Eq)] pub struct MyErr(String); impl std::error::Error for MyErr {} diff --git a/src/entity/active_enum.rs b/src/entity/active_enum.rs index db34eb34..2e03d4fd 100644 --- a/src/entity/active_enum.rs +++ b/src/entity/active_enum.rs @@ -139,7 +139,7 @@ mod tests { #[test] fn active_enum_string() { - #[derive(Debug, PartialEq, EnumIter)] + #[derive(Debug, PartialEq, Eq, EnumIter)] pub enum Category { Big, Small, @@ -176,7 +176,7 @@ mod tests { } } - #[derive(Debug, PartialEq, EnumIter, DeriveActiveEnum)] + #[derive(Debug, PartialEq, Eq, EnumIter, DeriveActiveEnum)] #[sea_orm( rs_type = "String", db_type = "String(Some(1))", @@ -234,7 +234,7 @@ mod tests { fn active_enum_derive_signed_integers() { macro_rules! test_num_value_int { ($ident: ident, $rs_type: expr, $db_type: expr, $col_def: ident) => { - #[derive(Debug, PartialEq, EnumIter, DeriveActiveEnum)] + #[derive(Debug, PartialEq, Eq, EnumIter, DeriveActiveEnum)] #[sea_orm(rs_type = $rs_type, db_type = $db_type)] pub enum $ident { #[sea_orm(num_value = -10)] @@ -251,7 +251,7 @@ mod tests { macro_rules! test_fallback_int { ($ident: ident, $fallback_type: ident, $rs_type: expr, $db_type: expr, $col_def: ident) => { - #[derive(Debug, PartialEq, EnumIter, DeriveActiveEnum)] + #[derive(Debug, PartialEq, Eq, EnumIter, DeriveActiveEnum)] #[sea_orm(rs_type = $rs_type, db_type = $db_type)] #[repr(i32)] pub enum $ident { @@ -300,7 +300,7 @@ mod tests { fn active_enum_derive_unsigned_integers() { macro_rules! test_num_value_uint { ($ident: ident, $rs_type: expr, $db_type: expr, $col_def: ident) => { - #[derive(Debug, PartialEq, EnumIter, DeriveActiveEnum)] + #[derive(Debug, PartialEq, Eq, EnumIter, DeriveActiveEnum)] #[sea_orm(rs_type = $rs_type, db_type = $db_type)] pub enum $ident { #[sea_orm(num_value = 1)] @@ -315,7 +315,7 @@ mod tests { macro_rules! test_fallback_uint { ($ident: ident, $fallback_type: ident, $rs_type: expr, $db_type: expr, $col_def: ident) => { - #[derive(Debug, PartialEq, EnumIter, DeriveActiveEnum)] + #[derive(Debug, PartialEq, Eq, EnumIter, DeriveActiveEnum)] #[sea_orm(rs_type = $rs_type, db_type = $db_type)] #[repr($fallback_type)] pub enum $ident { diff --git a/src/entity/base_entity.rs b/src/entity/base_entity.rs index 22c68701..443827d4 100644 --- a/src/entity/base_entity.rs +++ b/src/entity/base_entity.rs @@ -872,7 +872,7 @@ mod tests { use crate as sea_orm; use crate::entity::prelude::*; - #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] + #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "hello")] pub struct Model { #[sea_orm(primary_key)] @@ -898,7 +898,7 @@ mod tests { use crate as sea_orm; use crate::entity::prelude::*; - #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] + #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "hello", schema_name = "world")] pub struct Model { #[sea_orm(primary_key)] diff --git a/src/entity/column.rs b/src/entity/column.rs index 39a359d9..8dbff6ea 100644 --- a/src/entity/column.rs +++ b/src/entity/column.rs @@ -13,7 +13,7 @@ pub struct ColumnDef { } /// The type of column as defined in the SQL format -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub enum ColumnType { /// `CHAR` type of specified fixed length Char(Option), @@ -534,7 +534,7 @@ mod tests { use crate as sea_orm; use crate::entity::prelude::*; - #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] + #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "hello")] pub struct Model { #[sea_orm(primary_key)] @@ -608,7 +608,7 @@ mod tests { use crate as sea_orm; use crate::entity::prelude::*; - #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] + #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "hello")] pub struct Model { #[sea_orm(primary_key)] @@ -649,7 +649,7 @@ mod tests { } } - #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] + #[derive(Clone, Debug, PartialEq, Eq, DeriveModel, DeriveActiveModel)] pub struct Model { pub id: i32, pub one: i32, @@ -713,7 +713,7 @@ mod tests { use crate as sea_orm; use crate::entity::prelude::*; - #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] + #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "hello")] pub struct Model { #[sea_orm(primary_key)] @@ -754,7 +754,7 @@ mod tests { } } - #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] + #[derive(Clone, Debug, PartialEq, Eq, DeriveModel, DeriveActiveModel)] pub struct Model { pub id: i32, #[sea_orm(enum_name = "One1")] @@ -819,7 +819,7 @@ mod tests { use crate as sea_orm; use crate::entity::prelude::*; - #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] + #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "hello")] pub struct Model { #[sea_orm(primary_key, column_name = "ID", enum_name = "IdentityColumn")] @@ -861,7 +861,7 @@ mod tests { } } - #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] + #[derive(Clone, Debug, PartialEq, Eq, DeriveModel, DeriveActiveModel)] pub struct Model { #[sea_orm(enum_name = "IdentityCol")] pub id: i32, @@ -930,7 +930,7 @@ mod tests { use crate as sea_orm; use crate::entity::prelude::*; - #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] + #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "my_entity")] pub struct Model { #[sea_orm(primary_key, enum_name = "IdentityColumn", column_name = "id")] diff --git a/src/executor/delete.rs b/src/executor/delete.rs index ed2a2579..29ad02d3 100644 --- a/src/executor/delete.rs +++ b/src/executor/delete.rs @@ -11,7 +11,7 @@ pub struct Deleter { } /// The result of a DELETE operation -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct DeleteResult { /// The number of rows affected by the DELETE operation pub rows_affected: u64, diff --git a/src/executor/update.rs b/src/executor/update.rs index 38b7e29c..f00c536f 100644 --- a/src/executor/update.rs +++ b/src/executor/update.rs @@ -13,7 +13,7 @@ pub struct Updater { } /// The result of an update operation on an ActiveModel -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct UpdateResult { /// The rows affected by the update operation pub rows_affected: u64, diff --git a/src/tests_cfg/cake.rs b/src/tests_cfg/cake.rs index 875bd506..bb7b7952 100644 --- a/src/tests_cfg/cake.rs +++ b/src/tests_cfg/cake.rs @@ -4,7 +4,7 @@ use crate::entity::prelude::*; #[cfg(feature = "with-json")] use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[cfg_attr(feature = "with-json", derive(Serialize, Deserialize))] #[sea_orm(table_name = "cake")] pub struct Model { diff --git a/src/tests_cfg/cake_expanded.rs b/src/tests_cfg/cake_expanded.rs index b4306313..d0215b60 100644 --- a/src/tests_cfg/cake_expanded.rs +++ b/src/tests_cfg/cake_expanded.rs @@ -10,7 +10,7 @@ impl EntityName for Entity { } } -#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveModel, DeriveActiveModel)] pub struct Model { pub id: i32, pub name: String, diff --git a/src/tests_cfg/cake_filling.rs b/src/tests_cfg/cake_filling.rs index ed6d0af0..d41fa4b2 100644 --- a/src/tests_cfg/cake_filling.rs +++ b/src/tests_cfg/cake_filling.rs @@ -10,7 +10,7 @@ impl EntityName for Entity { } } -#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveModel, DeriveActiveModel)] pub struct Model { pub cake_id: i32, pub filling_id: i32, diff --git a/src/tests_cfg/cake_filling_price.rs b/src/tests_cfg/cake_filling_price.rs index 6d5a9b38..4d787a4b 100644 --- a/src/tests_cfg/cake_filling_price.rs +++ b/src/tests_cfg/cake_filling_price.rs @@ -14,7 +14,7 @@ impl EntityName for Entity { } } -#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveModel, DeriveActiveModel)] pub struct Model { pub cake_id: i32, pub filling_id: i32, diff --git a/src/tests_cfg/filling.rs b/src/tests_cfg/filling.rs index 4de591c5..882b76a9 100644 --- a/src/tests_cfg/filling.rs +++ b/src/tests_cfg/filling.rs @@ -5,7 +5,7 @@ use crate::entity::prelude::*; #[sea_orm(table_name = "filling")] pub struct Entity; -#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveModel, DeriveActiveModel)] pub struct Model { pub id: i32, pub name: String, diff --git a/src/tests_cfg/fruit.rs b/src/tests_cfg/fruit.rs index 592f0333..1bc0a9b3 100644 --- a/src/tests_cfg/fruit.rs +++ b/src/tests_cfg/fruit.rs @@ -4,7 +4,7 @@ use crate::entity::prelude::*; #[cfg(feature = "with-json")] use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[cfg_attr(feature = "with-json", derive(Serialize, Deserialize))] #[sea_orm(table_name = "fruit")] pub struct Model { diff --git a/src/tests_cfg/indexes.rs b/src/tests_cfg/indexes.rs index c823e31d..e4c2993c 100644 --- a/src/tests_cfg/indexes.rs +++ b/src/tests_cfg/indexes.rs @@ -15,7 +15,7 @@ impl EntityName for Entity { } } -#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveModel, DeriveActiveModel)] pub struct Model { pub indexes_id: i32, pub unique_attr: i32, diff --git a/src/tests_cfg/rust_keyword.rs b/src/tests_cfg/rust_keyword.rs index 2163664f..0d5dc474 100644 --- a/src/tests_cfg/rust_keyword.rs +++ b/src/tests_cfg/rust_keyword.rs @@ -1,7 +1,7 @@ use crate as sea_orm; use crate::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "rust_keyword")] pub struct Model { #[sea_orm(primary_key)] diff --git a/src/tests_cfg/vendor.rs b/src/tests_cfg/vendor.rs index 12b6affb..11e7c057 100644 --- a/src/tests_cfg/vendor.rs +++ b/src/tests_cfg/vendor.rs @@ -1,7 +1,7 @@ use crate as sea_orm; use crate::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "vendor")] pub struct Model { #[sea_orm(primary_key)] diff --git a/tests/common/bakery_chain/baker.rs b/tests/common/bakery_chain/baker.rs index ec3d3fb5..df56613a 100644 --- a/tests/common/bakery_chain/baker.rs +++ b/tests/common/bakery_chain/baker.rs @@ -1,6 +1,6 @@ use sea_orm::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "baker")] pub struct Model { #[sea_orm(primary_key)] diff --git a/tests/common/bakery_chain/cake.rs b/tests/common/bakery_chain/cake.rs index fe380d74..73b70195 100644 --- a/tests/common/bakery_chain/cake.rs +++ b/tests/common/bakery_chain/cake.rs @@ -1,6 +1,6 @@ use sea_orm::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "cake")] pub struct Model { #[sea_orm(primary_key)] diff --git a/tests/common/bakery_chain/cakes_bakers.rs b/tests/common/bakery_chain/cakes_bakers.rs index 3582ada0..e9543fba 100644 --- a/tests/common/bakery_chain/cakes_bakers.rs +++ b/tests/common/bakery_chain/cakes_bakers.rs @@ -1,6 +1,6 @@ use sea_orm::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "cakes_bakers")] pub struct Model { #[sea_orm(primary_key)] diff --git a/tests/common/bakery_chain/customer.rs b/tests/common/bakery_chain/customer.rs index 31e41018..b16884ed 100644 --- a/tests/common/bakery_chain/customer.rs +++ b/tests/common/bakery_chain/customer.rs @@ -1,6 +1,6 @@ use sea_orm::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "customer")] pub struct Model { #[sea_orm(primary_key)] diff --git a/tests/common/bakery_chain/lineitem.rs b/tests/common/bakery_chain/lineitem.rs index c2d18987..5b12d62c 100644 --- a/tests/common/bakery_chain/lineitem.rs +++ b/tests/common/bakery_chain/lineitem.rs @@ -1,6 +1,6 @@ use sea_orm::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "lineitem")] pub struct Model { #[sea_orm(primary_key)] diff --git a/tests/common/bakery_chain/order.rs b/tests/common/bakery_chain/order.rs index ed6185cf..020de925 100644 --- a/tests/common/bakery_chain/order.rs +++ b/tests/common/bakery_chain/order.rs @@ -1,6 +1,6 @@ use sea_orm::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "order")] pub struct Model { #[sea_orm(primary_key)] diff --git a/tests/common/features/active_enum.rs b/tests/common/features/active_enum.rs index 1c043c3e..e93de4dd 100644 --- a/tests/common/features/active_enum.rs +++ b/tests/common/features/active_enum.rs @@ -1,7 +1,7 @@ use super::sea_orm_active_enums::*; use sea_orm::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[cfg_attr(feature = "sqlx-postgres", sea_orm(schema_name = "public"))] #[sea_orm(table_name = "active_enum")] pub struct Model { diff --git a/tests/common/features/active_enum_child.rs b/tests/common/features/active_enum_child.rs index 1a9d0d04..a719cfce 100644 --- a/tests/common/features/active_enum_child.rs +++ b/tests/common/features/active_enum_child.rs @@ -1,7 +1,7 @@ use super::sea_orm_active_enums::*; use sea_orm::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[cfg_attr(feature = "sqlx-postgres", sea_orm(schema_name = "public"))] #[sea_orm(table_name = "active_enum_child")] pub struct Model { diff --git a/tests/common/features/applog.rs b/tests/common/features/applog.rs index 1f83ca8f..98fd1869 100644 --- a/tests/common/features/applog.rs +++ b/tests/common/features/applog.rs @@ -1,6 +1,6 @@ use sea_orm::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "applog")] pub struct Model { #[sea_orm(primary_key)] diff --git a/tests/common/features/byte_primary_key.rs b/tests/common/features/byte_primary_key.rs index 7578e3c8..56d90b0c 100644 --- a/tests/common/features/byte_primary_key.rs +++ b/tests/common/features/byte_primary_key.rs @@ -1,6 +1,6 @@ use sea_orm::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "byte_primary_key")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] diff --git a/tests/common/features/insert_default.rs b/tests/common/features/insert_default.rs index 166856f6..fde50d95 100644 --- a/tests/common/features/insert_default.rs +++ b/tests/common/features/insert_default.rs @@ -1,6 +1,6 @@ use sea_orm::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "insert_default")] pub struct Model { #[sea_orm(primary_key)] diff --git a/tests/common/features/json_vec.rs b/tests/common/features/json_vec.rs index 506003cb..aebd6799 100644 --- a/tests/common/features/json_vec.rs +++ b/tests/common/features/json_vec.rs @@ -2,7 +2,7 @@ use sea_orm::entity::prelude::*; use sea_orm::{TryGetError, TryGetable}; use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "json_vec")] pub struct Model { #[sea_orm(primary_key)] @@ -15,7 +15,7 @@ pub enum Relation {} impl ActiveModelBehavior for ActiveModel {} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct StringVec(pub Vec); impl From for Value { diff --git a/tests/common/features/metadata.rs b/tests/common/features/metadata.rs index 2c297cd3..688c005c 100644 --- a/tests/common/features/metadata.rs +++ b/tests/common/features/metadata.rs @@ -1,6 +1,6 @@ use sea_orm::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "metadata")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] diff --git a/tests/common/features/repository.rs b/tests/common/features/repository.rs index 6092abf2..651a0bc5 100644 --- a/tests/common/features/repository.rs +++ b/tests/common/features/repository.rs @@ -1,6 +1,6 @@ use sea_orm::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "repository")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] diff --git a/tests/common/features/satellite.rs b/tests/common/features/satellite.rs index 5db48274..b798a6b3 100644 --- a/tests/common/features/satellite.rs +++ b/tests/common/features/satellite.rs @@ -1,6 +1,6 @@ use sea_orm::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "satellite")] pub struct Model { #[sea_orm(primary_key)] diff --git a/tests/common/features/sea_orm_active_enums.rs b/tests/common/features/sea_orm_active_enums.rs index 00bff5b0..57ba0551 100644 --- a/tests/common/features/sea_orm_active_enums.rs +++ b/tests/common/features/sea_orm_active_enums.rs @@ -1,6 +1,6 @@ use sea_orm::entity::prelude::*; -#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum)] +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)] #[sea_orm(rs_type = "String", db_type = "String(Some(1))")] pub enum Category { #[sea_orm(string_value = "B")] @@ -9,7 +9,7 @@ pub enum Category { Small, } -#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum)] +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)] #[sea_orm(rs_type = "i32", db_type = "Integer")] pub enum Color { #[sea_orm(num_value = 0)] @@ -18,7 +18,7 @@ pub enum Color { White, } -#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum)] +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)] #[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "tea")] pub enum Tea { #[sea_orm(string_value = "EverydayTea")] diff --git a/tests/common/features/self_join.rs b/tests/common/features/self_join.rs index de491a09..933eff15 100644 --- a/tests/common/features/self_join.rs +++ b/tests/common/features/self_join.rs @@ -1,6 +1,6 @@ use sea_orm::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "self_join")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] diff --git a/tests/common/features/transaction_log.rs b/tests/common/features/transaction_log.rs index 06010db5..137240f5 100644 --- a/tests/common/features/transaction_log.rs +++ b/tests/common/features/transaction_log.rs @@ -1,6 +1,6 @@ use sea_orm::entity::prelude::*; -#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "transaction_log")] pub struct Model { #[sea_orm(primary_key)] diff --git a/tests/common/setup/mod.rs b/tests/common/setup/mod.rs index 519be2e3..5ea607c7 100644 --- a/tests/common/setup/mod.rs +++ b/tests/common/setup/mod.rs @@ -9,7 +9,7 @@ use sea_query::{ }; pub async fn setup(base_url: &str, db_name: &str) -> DatabaseConnection { - let db = if cfg!(feature = "sqlx-mysql") { + if cfg!(feature = "sqlx-mysql") { let url = format!("{}/mysql", base_url); let db = Database::connect(&url).await.unwrap(); let _drop_db_result = db @@ -49,9 +49,7 @@ pub async fn setup(base_url: &str, db_name: &str) -> DatabaseConnection { Database::connect(&url).await.unwrap() } else { Database::connect(base_url).await.unwrap() - }; - - db + } } pub async fn tear_down(base_url: &str, db_name: &str) {