aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-08-10 12:53:10 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-08-10 12:53:10 +0200
commit44e47415049b2d7ef77a025bc465a33a8469b5c6 (patch)
treeaf838ef80b3f9093a4890e0d84e448b4944d49b0
parent68572d35cef7e1c9813e032f4c278d7eaa57a07a (diff)
downloadaskama-44e47415049b2d7ef77a025bc465a33a8469b5c6.tar.gz
askama-44e47415049b2d7ef77a025bc465a33a8469b5c6.tar.bz2
askama-44e47415049b2d7ef77a025bc465a33a8469b5c6.zip
Replace unwrap() with expect() call for parent type finding
Diffstat (limited to '')
-rw-r--r--askama_derive/src/generator.rs4
1 files changed, 3 insertions, 1 deletions
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<Node>) -> 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 };