diff options
Diffstat (limited to '')
-rw-r--r-- | askama_derive/src/lib.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/askama_derive/src/lib.rs b/askama_derive/src/lib.rs index 012ad65..7c92fdc 100644 --- a/askama_derive/src/lib.rs +++ b/askama_derive/src/lib.rs @@ -6,9 +6,9 @@ use proc_macro::TokenStream; #[proc_macro_derive(Template, attributes(template))] pub fn derive_template(input: TokenStream) -> TokenStream { - let ast = syn::parse_derive_input(&input.to_string()).unwrap(); - match ast.body { - syn::Body::Struct(ref data) => data, + let ast: syn::DeriveInput = syn::parse(input).unwrap(); + match ast.data { + syn::Data::Struct(ref data) => data, _ => panic!("#[derive(Template)] can only be used with structs"), }; shared::build_template(&ast).parse().unwrap() |