Skip to content

Commit

Permalink
Also provide a smarter alternative for the other impossible case
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jan 11, 2017
1 parent d2eea87 commit b01c23b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion serde_codegen/src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,9 @@ fn deserialize_item_enum(
// This is an empty enum like `enum Impossible {}` or an enum in which
// all variants have `#[serde(skip_deserializing)]`.
quote! {
// FIXME: Once we drop support for Rust 1.15:
// let Err(err) = visitor.visit_variant::<__Field>();
// Err(err)
visitor.visit_variant::<__Field>().map(|impossible| match impossible {})
}
} else {
Expand Down Expand Up @@ -749,7 +752,7 @@ fn deserialize_map(
) -> Tokens {
if fields.is_empty() && item_attrs.deny_unknown_fields() {
return quote! {
// Once we drop support for Rust 1.15:
// FIXME: Once we drop support for Rust 1.15:
// let None::<__Field> = try!(visitor.visit_key());
try!(visitor.visit_key::<__Field>()).map(|impossible| match impossible {});
try!(visitor.end());
Expand Down

0 comments on commit b01c23b

Please sign in to comment.