Skip to content

Commit

Permalink
Rename variant_names_idents -> variant_idents_aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Oct 22, 2024
1 parent 0a06af8 commit c6a5be7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions serde_derive/src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1252,12 +1252,12 @@ fn prepare_enum_variant_enum(variants: &[Variant]) -> (TokenStream, Stmts) {
}
};

let variant_names_idents: Vec<_> = deserialized_variants
let variant_idents_aliases: Vec<_> = deserialized_variants
.map(|(i, variant)| (field_i(i), variant.attrs.aliases()))
.collect();

let variant_visitor = Stmts(deserialize_generated_identifier(
&variant_names_idents,
&variant_idents_aliases,
false, // variant identifiers do not depend on the presence of flatten fields
true,
None,
Expand Down Expand Up @@ -2130,12 +2130,12 @@ fn deserialize_custom_identifier(
(variants, None, None)
};

let names_idents: Vec<_> = ordinary
let idents_aliases: Vec<_> = ordinary
.iter()
.map(|variant| (variant.ident.clone(), variant.attrs.aliases()))
.collect();

let names = names_idents.iter().flat_map(|&(_, aliases)| aliases);
let names = idents_aliases.iter().flat_map(|&(_, aliases)| aliases);

let names_const = if fallthrough.is_some() {
None
Expand All @@ -2158,7 +2158,7 @@ fn deserialize_custom_identifier(
let delife = params.borrowed.de_lifetime();
let visitor_impl = Stmts(deserialize_identifier(
&this_value,
&names_idents,
&idents_aliases,
is_variant,
fallthrough,
fallthrough_borrowed,
Expand Down

0 comments on commit c6a5be7

Please sign in to comment.