Delete Decoder::read_struct

This commit is contained in:
Mark Rousskov 2022-02-09 17:20:43 -05:00
parent a421b631ba
commit c021ba48a7
5 changed files with 74 additions and 98 deletions

View file

@ -42,15 +42,7 @@ fn decodable_body(
}
let ty_name = s.ast().ident.to_string();
let decode_body = match s.variants() {
[vi] => {
let construct = vi.construct(|field, index| decode_field(field, index, true));
quote! {
::rustc_serialize::Decoder::read_struct(
__decoder,
|__decoder| { #construct },
)
}
}
[vi] => vi.construct(|field, index| decode_field(field, index, true)),
variants => {
let match_inner: TokenStream = variants
.iter()