Skip to content

Commit 562778f

Browse files
committed
One last refactor
1 parent e3f64b1 commit 562778f

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

sea-orm-macros/src/derives/active_enum.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl ActiveEnum {
4040
let mut db_type = Err(Error::TT(quote_spanned! {
4141
ident_span => compile_error!("Missing macro attribute `db_type`");
4242
}));
43-
let mut rename_all_rule = None;
43+
let mut rename_all = None;
4444

4545
input
4646
.attrs
@@ -72,7 +72,7 @@ impl ActiveEnum {
7272
let litstr: LitStr = meta.value()?.parse()?;
7373
enum_name = litstr.value();
7474
} else if meta.path.is_ident("rename_all") {
75-
rename_all_rule = Some((&meta).try_into()?);
75+
rename_all = Some((&meta).try_into()?);
7676
} else {
7777
return Err(meta.error(format!(
7878
"Unknown attribute parameter found: {:?}",
@@ -89,7 +89,7 @@ impl ActiveEnum {
8989
_ => return Err(Error::InputNotEnum),
9090
};
9191

92-
let mut is_string = rename_all_rule.is_some();
92+
let mut is_string = rename_all.is_some();
9393
let mut is_int = false;
9494
let mut variants = Vec::new();
9595

@@ -135,9 +135,7 @@ impl ActiveEnum {
135135
}));
136136
}
137137

138-
if string_value.is_none()
139-
&& num_value.is_none()
140-
&& rename_rule.or(rename_all_rule).is_none()
138+
if string_value.is_none() && num_value.is_none() && rename_rule.or(rename_all).is_none()
141139
{
142140
match variant.discriminant {
143141
Some((_, Expr::Lit(exprlit))) => {
@@ -191,7 +189,7 @@ impl ActiveEnum {
191189
db_type: db_type?,
192190
is_string,
193191
variants,
194-
rename_all: rename_all_rule,
192+
rename_all,
195193
})
196194
}
197195

0 commit comments

Comments
 (0)