aboutsummaryrefslogtreecommitdiffstats
path: root/askama_shared/src
diff options
context:
space:
mode:
Diffstat (limited to 'askama_shared/src')
-rw-r--r--askama_shared/src/input.rs22
1 files changed, 9 insertions, 13 deletions
diff --git a/askama_shared/src/input.rs b/askama_shared/src/input.rs
index 371cf6d..95233d3 100644
--- a/askama_shared/src/input.rs
+++ b/askama_shared/src/input.rs
@@ -99,21 +99,17 @@ impl<'a> TemplateMeta<'a> {
}
}
- match source {
- Some(s) => {
- match (&s, ext.is_some()) {
- (&Source::Path(_), true) => {
- panic!("'ext' attribute cannot be used with 'path' attribute")
- },
- (&Source::Source(_), false) => {
- panic!("must include 'ext' attribute when using 'source' attribute")
- },
- _ => {},
- }
- TemplateMeta { source: s, print, escaping, ext }
+ let source = source.expect("template path or source not found in attributes");
+ match (&source, ext.is_some()) {
+ (&Source::Path(_), true) => {
+ panic!("'ext' attribute cannot be used with 'path' attribute")
+ },
+ (&Source::Source(_), false) => {
+ panic!("must include 'ext' attribute when using 'source' attribute")
},
- None => panic!("template path or source not found in struct attributes"),
+ _ => {},
}
+ TemplateMeta { source, print, escaping, ext }
}
}