From 44e47415049b2d7ef77a025bc465a33a8469b5c6 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Thu, 10 Aug 2017 12:53:10 +0200 Subject: Replace unwrap() with expect() call for parent type finding --- askama_derive/src/generator.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'askama_derive/src') diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index 7cdc7b4..409b698 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -38,7 +38,9 @@ pub fn generate(ast: &syn::DeriveInput, path: &str, mut nodes: Vec) -> Str if base.is_none() { gen.define_trait(&trait_name, &block_names); } else { - gen.deref_to_parent(ast, &get_parent_type(ast).unwrap()); + let parent_type = get_parent_type(ast) + .expect("expected field '_parent' in extending template struct"); + gen.deref_to_parent(ast, &parent_type); } let trait_nodes = if base.is_none() { Some(&content[..]) } else { None }; -- cgit