aboutsummaryrefslogtreecommitdiffstats
path: root/askama_shared
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--askama_shared/src/input.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/askama_shared/src/input.rs b/askama_shared/src/input.rs
index 7d27eb3..371cf6d 100644
--- a/askama_shared/src/input.rs
+++ b/askama_shared/src/input.rs
@@ -101,10 +101,14 @@ impl<'a> TemplateMeta<'a> {
match source {
Some(s) => {
- if let Source::Path(_) = s {
- if ext.is_some() {
- panic!("'ext' attribute cannot be used with 'path' attribute");
- }
+ 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 }
},