This commit is contained in:
Dirkjan Ochtman 2022-09-01 09:51:43 +02:00
parent 04a74637c8
commit 096ce33228
1 changed files with 7 additions and 15 deletions

View File

@ -235,8 +235,8 @@ impl Deserializer {
)); ));
let def_prefix = match def_prefix { let def_prefix = match def_prefix {
Some(def_prefix) => quote!(let def_prefix: Option<&str> = Some(#def_prefix);), Some(def_prefix) => quote!(Some(#def_prefix)),
None => quote!(let def_prefix: Option<&str> = None;), None => quote!(None),
}; };
let field_namespace = match field_namespace { let field_namespace = match field_namespace {
@ -256,8 +256,7 @@ impl Deserializer {
match item.prefix { match item.prefix {
Some(item) => { Some(item) => {
let parser_prefix = item.to_owned(); let parser_prefix = item.to_owned();
#def_prefix match #def_prefix {
match def_prefix {
Some(def_prefix) => { Some(def_prefix) => {
// Check if defined and gotten namespaces equals for each field // Check if defined and gotten namespaces equals for each field
if deserializer.parser_namespace(&parser_prefix) if deserializer.parser_namespace(&parser_prefix)
@ -265,21 +264,14 @@ impl Deserializer {
return Err(Error::WrongNamespace) return Err(Error::WrongNamespace)
} }
} }
None => { None => return Err(Error::WrongNamespace),
return Err(Error::WrongNamespace);
} }
} }
} None => match #def_prefix {
None => { Some(_) => return Err(Error::WrongNamespace),
#def_prefix
match def_prefix {
Some(_) => {
return Err(Error::WrongNamespace)
},
None => (), None => (),
} }
} }
}
#field_namespace #field_namespace
deserializer.set_next_def_namespace(field_namespace)?; deserializer.set_next_def_namespace(field_namespace)?;
#enum_name = Some(#field_type::deserialize(deserializer)?); #enum_name = Some(#field_type::deserialize(deserializer)?);