diff options
Diffstat (limited to 'askama_shared/src/input.rs')
-rw-r--r-- | askama_shared/src/input.rs | 14 |
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")))?; |