aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2021-10-13 10:10:04 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2021-11-10 11:04:13 +0100
commitf06022c70f2411252ad7ebb8214e0826beaefcf8 (patch)
tree0f3c5e2bcfa0a07896b84db731bcd00262b31fbb
parent028eb1c3103ee59163b7b14829583a174a43b12a (diff)
downloadaskama-f06022c70f2411252ad7ebb8214e0826beaefcf8.tar.gz
askama-f06022c70f2411252ad7ebb8214e0826beaefcf8.tar.bz2
askama-f06022c70f2411252ad7ebb8214e0826beaefcf8.zip
Don't parse non-template attributes
Diffstat (limited to '')
-rw-r--r--askama_shared/src/input.rs14
1 files changed, 5 insertions, 9 deletions
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")))?;