Skip to content

Commit 070cce0

Browse files
committed
Get rid of temporary variable
1 parent b58e8ba commit 070cce0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

serde_derive/src/de.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,12 @@ fn prepare_enum_variant_enum(
12371237
})
12381238
.collect();
12391239

1240-
let other_idx = deserialized_variants.position(|(_, variant)| variant.attrs.other());
1240+
let fallthrough = deserialized_variants
1241+
.position(|(_, variant)| variant.attrs.other())
1242+
.map(|other_idx| {
1243+
let ignore_variant = variant_names_idents[other_idx].1.clone();
1244+
quote!(_serde::__private::Ok(__Field::#ignore_variant))
1245+
});
12411246

12421247
let variants_stmt = {
12431248
let variant_names = variant_names_idents.iter().map(|(name, _, _)| name);
@@ -1247,11 +1252,6 @@ fn prepare_enum_variant_enum(
12471252
}
12481253
};
12491254

1250-
let fallthrough = other_idx.map(|other_idx| {
1251-
let ignore_variant = variant_names_idents[other_idx].1.clone();
1252-
quote!(_serde::__private::Ok(__Field::#ignore_variant))
1253-
});
1254-
12551255
let variant_visitor = Stmts(deserialize_generated_identifier(
12561256
&variant_names_idents,
12571257
cattrs,

0 commit comments

Comments
 (0)