diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-09-06 20:03:22 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-09-06 20:03:47 +0200 |
commit | ddcc0453ba8803ba8f15eb1de030cd5f96731ed5 (patch) | |
tree | fadc5bb629061004a49d7d3ca60a7fbc80e0a448 /askama_shared/src/input.rs | |
parent | 09514f07ee1a649281e5b41015b99235309416ea (diff) | |
download | askama-ddcc0453ba8803ba8f15eb1de030cd5f96731ed5.tar.gz askama-ddcc0453ba8803ba8f15eb1de030cd5f96731ed5.tar.bz2 askama-ddcc0453ba8803ba8f15eb1de030cd5f96731ed5.zip |
Make path and source attributes mutually exclusive
Diffstat (limited to 'askama_shared/src/input.rs')
-rw-r--r-- | askama_shared/src/input.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/askama_shared/src/input.rs b/askama_shared/src/input.rs index 43aa400..5fc064b 100644 --- a/askama_shared/src/input.rs +++ b/askama_shared/src/input.rs @@ -54,11 +54,17 @@ impl<'a> TemplateMeta<'a> { if let syn::MetaItem::NameValue(ref key, ref val) = *item { match key.as_ref() { "path" => if let syn::Lit::Str(ref s, _) = *val { + if source.is_some() { + panic!("must specify 'source' or 'path', not both"); + } source = Some(Source::Path(s.as_ref())); } else { panic!("template path must be string literal"); }, "source" => if let syn::Lit::Str(ref s, _) = *val { + if source.is_some() { + panic!("must specify 'source' or 'path', not both"); + } source = Some(Source::Source(s.as_ref())); } else { panic!("template source must be string literal"); |