From 6059cdd9adf7af4768b1dd727b6730dfcc930c46 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Mon, 25 Oct 2021 16:56:36 +0800 Subject: [PATCH] Remove unused EnumIter --- src/entity/active_enum.rs | 18 +++++++++--------- tests/common/features/active_enum.rs | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/entity/active_enum.rs b/src/entity/active_enum.rs index 230ee8f2..5eb77b9f 100644 --- a/src/entity/active_enum.rs +++ b/src/entity/active_enum.rs @@ -1,4 +1,4 @@ -use crate::{ColumnDef, DbErr, Iterable, TryGetable}; +use crate::{ColumnDef, DbErr, TryGetable}; use sea_query::{Nullable, Value, ValueType}; /// A Rust representation of enum defined in database. @@ -17,7 +17,7 @@ use sea_query::{Nullable, Value, ValueType}; /// use sea_orm::entity::prelude::*; /// /// // Using the derive macro -/// #[derive(Debug, PartialEq, EnumIter, DeriveActiveEnum)] +/// #[derive(Debug, PartialEq, DeriveActiveEnum)] /// #[sea_orm(rs_type = "String", db_type = "String(Some(1))")] /// pub enum DeriveCategory { /// #[sea_orm(string_value = "B")] @@ -27,7 +27,7 @@ use sea_query::{Nullable, Value, ValueType}; /// } /// /// // Implementing it manually -/// #[derive(Debug, PartialEq, EnumIter)] +/// #[derive(Debug, PartialEq)] /// pub enum Category { /// Big, /// Small, @@ -71,7 +71,7 @@ use sea_query::{Nullable, Value, ValueType}; /// use sea_orm::entity::prelude::*; /// /// // Define the `Category` active enum -/// #[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum)] +/// #[derive(Debug, Clone, PartialEq, DeriveActiveEnum)] /// #[sea_orm(rs_type = "String", db_type = "String(Some(1))")] /// pub enum Category { /// #[sea_orm(string_value = "B")] @@ -95,7 +95,7 @@ use sea_query::{Nullable, Value, ValueType}; /// /// impl ActiveModelBehavior for ActiveModel {} /// ``` -pub trait ActiveEnum: Sized + Iterable { +pub trait ActiveEnum: Sized { /// Define the Rust type that each enum variant represents. type Value: Into + ValueType + Nullable + TryGetable; @@ -117,7 +117,7 @@ mod tests { #[test] fn active_enum_string() { - #[derive(Debug, PartialEq, EnumIter)] + #[derive(Debug, PartialEq)] pub enum Category { Big, Small, @@ -150,7 +150,7 @@ mod tests { } } - #[derive(Debug, PartialEq, EnumIter, DeriveActiveEnum)] + #[derive(Debug, PartialEq, DeriveActiveEnum)] #[sea_orm(rs_type = "String", db_type = "String(Some(1))")] pub enum DeriveCategory { #[sea_orm(string_value = "B")] @@ -201,7 +201,7 @@ mod tests { fn active_enum_derive_signed_integers() { macro_rules! test_int { ($ident: ident, $rs_type: expr, $db_type: expr, $col_def: ident) => { - #[derive(Debug, PartialEq, EnumIter, DeriveActiveEnum)] + #[derive(Debug, PartialEq, DeriveActiveEnum)] #[sea_orm(rs_type = $rs_type, db_type = $db_type)] pub enum $ident { #[sea_orm(num_value = 1)] @@ -241,7 +241,7 @@ mod tests { fn active_enum_derive_unsigned_integers() { macro_rules! test_uint { ($ident: ident, $rs_type: expr, $db_type: expr, $col_def: ident) => { - #[derive(Debug, PartialEq, EnumIter, DeriveActiveEnum)] + #[derive(Debug, PartialEq, DeriveActiveEnum)] #[sea_orm(rs_type = $rs_type, db_type = $db_type)] pub enum $ident { #[sea_orm(num_value = 1)] diff --git a/tests/common/features/active_enum.rs b/tests/common/features/active_enum.rs index 78f21790..f152f37c 100644 --- a/tests/common/features/active_enum.rs +++ b/tests/common/features/active_enum.rs @@ -15,7 +15,7 @@ pub enum Relation {} impl ActiveModelBehavior for ActiveModel {} -#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum)] +#[derive(Debug, Clone, PartialEq, DeriveActiveEnum)] #[sea_orm(rs_type = "String", db_type = "String(Some(1))")] pub enum Category { #[sea_orm(string_value = "B")] @@ -24,7 +24,7 @@ pub enum Category { Small, } -#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum)] +#[derive(Debug, Clone, PartialEq, DeriveActiveEnum)] #[sea_orm(rs_type = "i32", db_type = r#"Integer"#)] pub enum Color { #[sea_orm(num_value = 0)] @@ -33,7 +33,7 @@ pub enum Color { White, } -#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum)] +#[derive(Debug, Clone, PartialEq, DeriveActiveEnum)] #[sea_orm( rs_type = "String", db_type = r#"Enum("tea".to_owned(), vec!["EverydayTea".to_owned(), "BreakfastTea".to_owned()])"#