From ddcc0453ba8803ba8f15eb1de030cd5f96731ed5 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 6 Sep 2017 20:03:22 +0200 Subject: Make path and source attributes mutually exclusive --- askama_shared/src/input.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'askama_shared/src') 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"); -- cgit