Skip to content

Commit ca1cac5

Browse files
committed
Allowed non_camel_case_types on enums
Added this macro because enums which contain non-pascalized cases due to 2a97fcd would trigger a clippy lint.
1 parent 93d699c commit ca1cac5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

xsd-parser/src/generator/enum.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,24 @@ pub trait EnumGenerator {
6161
}
6262

6363
fn macros(&self, entity: &Enum, gen: &Generator) -> Cow<'static, str> {
64+
let allows = "#[allow(non_camel_case_types)]\n";
65+
6466
if entity.source == EnumSource::Union {
65-
return "#[derive(PartialEq, Debug, UtilsUnionSerDe)]\n".into();
67+
return format!("{allows}#[derive(PartialEq, Debug, UtilsUnionSerDe)]").into();
6668
}
6769

6870
let derives = "#[derive(PartialEq, Debug, YaSerialize, YaDeserialize)]\n";
6971
let tns = gen.target_ns.borrow();
7072
match tns.as_ref() {
7173
Some(tn) => match tn.name() {
7274
Some(name) => format!(
73-
"{derives}#[yaserde(prefix = \"{prefix}\", namespace = \"{prefix}: {uri}\")]\n",
75+
"{allows}{derives}#[yaserde(prefix = \"{prefix}\", namespace = \"{prefix}: {uri}\")]\n",
7476
derives = derives,
7577
prefix = name,
7678
uri = tn.uri()
7779
),
7880
None => format!(
79-
"{derives}#[yaserde(namespace = \"{uri}\")]\n",
81+
"{allows}{derives}#[yaserde(namespace = \"{uri}\")]\n",
8082
derives = derives,
8183
uri = tn.uri()
8284
),

0 commit comments

Comments
 (0)