mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-21 07:21:05 +00:00
Get rid of temporary variable
This commit is contained in:
@@ -1237,7 +1237,12 @@ fn prepare_enum_variant_enum(
|
|||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let other_idx = deserialized_variants.position(|(_, variant)| variant.attrs.other());
|
let fallthrough = deserialized_variants
|
||||||
|
.position(|(_, variant)| variant.attrs.other())
|
||||||
|
.map(|other_idx| {
|
||||||
|
let ignore_variant = variant_names_idents[other_idx].1.clone();
|
||||||
|
quote!(_serde::__private::Ok(__Field::#ignore_variant))
|
||||||
|
});
|
||||||
|
|
||||||
let variants_stmt = {
|
let variants_stmt = {
|
||||||
let variant_names = variant_names_idents.iter().map(|(name, _, _)| name);
|
let variant_names = variant_names_idents.iter().map(|(name, _, _)| name);
|
||||||
@@ -1247,11 +1252,6 @@ fn prepare_enum_variant_enum(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let fallthrough = other_idx.map(|other_idx| {
|
|
||||||
let ignore_variant = variant_names_idents[other_idx].1.clone();
|
|
||||||
quote!(_serde::__private::Ok(__Field::#ignore_variant))
|
|
||||||
});
|
|
||||||
|
|
||||||
let variant_visitor = Stmts(deserialize_generated_identifier(
|
let variant_visitor = Stmts(deserialize_generated_identifier(
|
||||||
&variant_names_idents,
|
&variant_names_idents,
|
||||||
cattrs,
|
cattrs,
|
||||||
|
|||||||
Reference in New Issue
Block a user