Skip to content

Commit

Permalink
Replace if let Some(...) = ... to Option::map
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingun committed Aug 6, 2023
1 parent ada50b0 commit b58e8ba
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions serde_derive/src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1247,13 +1247,10 @@ fn prepare_enum_variant_enum(
}
};

let fallthrough = if let Some(other_idx) = other_idx {
let fallthrough = other_idx.map(|other_idx| {
let ignore_variant = variant_names_idents[other_idx].1.clone();
let fallthrough = quote!(_serde::__private::Ok(__Field::#ignore_variant));
Some(fallthrough)
} else {
None
};
quote!(_serde::__private::Ok(__Field::#ignore_variant))
});

let variant_visitor = Stmts(deserialize_generated_identifier(
&variant_names_idents,
Expand Down

0 comments on commit b58e8ba

Please sign in to comment.