From f06022c70f2411252ad7ebb8214e0826beaefcf8 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 13 Oct 2021 10:10:04 +0200 Subject: Don't parse non-template attributes --- askama_shared/src/input.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'askama_shared/src') diff --git a/askama_shared/src/input.rs b/askama_shared/src/input.rs index c94c217..30340b5 100644 --- a/askama_shared/src/input.rs +++ b/askama_shared/src/input.rs @@ -31,15 +31,11 @@ impl<'a> TemplateInput<'a> { let meta = ast .attrs .iter() - .find_map(|attr| match attr.parse_meta() { - Ok(m) => { - if m.path().is_ident("template") { - Some(Ok(m)) - } else { - None - } - } - Err(e) => Some(Err(format!("unable to parse attribute: {}", e).into())), + .find_map(|attr| { + attr.path.is_ident("template").then(|| { + attr.parse_meta() + .map_err(|e| format!("unable to parse attribute: {}", e).into()) + }) }) .unwrap_or(Err(CompileError::Static("no attribute 'template' found")))?; -- cgit