Skip to content

Commit

Permalink
Inline #match_keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingun committed Aug 10, 2023
1 parent 5c15b61 commit c2f995c
Showing 1 changed file with 16 additions and 24 deletions.
40 changes: 16 additions & 24 deletions serde_derive/src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2556,17 +2556,6 @@ fn deserialize_map(
})
};

let match_keys = quote! {
let mut __seed = #field_seed;
while let _serde::__private::Some(__key) = _serde::de::MapAccess::next_key_seed(&mut __map, &mut __seed)? {
match __key {
#(#value_arms)*
#field_enum::Field(_) => unreachable!(),
#ignored_arm
}
}
};

let extract_values = fields_names
.iter()
.filter(|&&(field, _)| !field.attrs.skip_deserializing() && !field.attrs.flatten())
Expand Down Expand Up @@ -2657,7 +2646,14 @@ fn deserialize_map(

#let_collect

#match_keys
let mut __seed = #field_seed;
while let _serde::__private::Some(__key) = _serde::de::MapAccess::next_key_seed(&mut __map, &mut __seed)? {
match __key {
#(#value_arms)*
#field_enum::Field(_) => unreachable!(),
#ignored_arm
}
}

#let_default

Expand Down Expand Up @@ -2747,17 +2743,6 @@ fn deserialize_map_in_place(
})
};

let match_keys = quote! {
let mut __seed = #field_seed;
while let _serde::__private::Some(__key) = _serde::de::MapAccess::next_key_seed(&mut __map, &mut __seed)? {
match __key {
#(#value_arms_from)*
#field_enum::Field(_) => unreachable!(),
#ignored_arm
}
}
};

let check_flags = fields_names
.iter()
.filter(|&&(field, _)| !field.attrs.skip_deserializing())
Expand Down Expand Up @@ -2806,7 +2791,14 @@ fn deserialize_map_in_place(
quote_block! {
#(#let_flags)*

#match_keys
let mut __seed = #field_seed;
while let _serde::__private::Some(__key) = _serde::de::MapAccess::next_key_seed(&mut __map, &mut __seed)? {
match __key {
#(#value_arms_from)*
#field_enum::Field(_) => unreachable!(),
#ignored_arm
}
}

#let_default

Expand Down

0 comments on commit c2f995c

Please sign in to comment.