diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-09-07 20:42:54 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-09-07 20:42:54 +0200 |
commit | ee9db1dbf441b0fd17058b56d39a27abf9d3e517 (patch) | |
tree | 4c1a5b7754a4bd85ad231e74ad0686039f7cedc6 /askama_shared/src | |
parent | 5503b945cc9ec274ae3d859330767e1088b13a52 (diff) | |
download | askama-ee9db1dbf441b0fd17058b56d39a27abf9d3e517.tar.gz askama-ee9db1dbf441b0fd17058b56d39a27abf9d3e517.tar.bz2 askama-ee9db1dbf441b0fd17058b56d39a27abf9d3e517.zip |
Make ext attribute mandatory for source-specified templates
Diffstat (limited to '')
-rw-r--r-- | askama_shared/src/input.rs | 12 |
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 } }, |