diff options
author | 2022-02-03 14:55:33 +0100 | |
---|---|---|
committer | 2022-02-03 18:09:55 +0100 | |
commit | 2d457f54f50de8a9430f1e6e3da42244957911d1 (patch) | |
tree | f4c95ace64ebe9befbb13fbe5ca0c84461d8f416 /askama_shared/src/input.rs | |
parent | a480c25efe8ddc9c0d6a6a9e3c990ce730c315e4 (diff) | |
download | askama-2d457f54f50de8a9430f1e6e3da42244957911d1.tar.gz askama-2d457f54f50de8a9430f1e6e3da42244957911d1.tar.bz2 askama-2d457f54f50de8a9430f1e6e3da42244957911d1.zip |
Replace custom Cow with actual Cow
Diffstat (limited to 'askama_shared/src/input.rs')
-rw-r--r-- | askama_shared/src/input.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/askama_shared/src/input.rs b/askama_shared/src/input.rs index b9341a2..ef27630 100644 --- a/askama_shared/src/input.rs +++ b/askama_shared/src/input.rs @@ -34,7 +34,7 @@ impl TemplateInput<'_> { for attr in &ast.attrs { if attr.path.is_ident("template") { if template_args.is_some() { - return Err(CompileError::Static("duplicated 'template' attribute")); + return Err("duplicated 'template' attribute".into()); } match attr.parse_meta() { @@ -47,7 +47,7 @@ impl TemplateInput<'_> { } } let template_args = - template_args.ok_or(CompileError::Static("no attribute 'template' found"))?; + template_args.ok_or_else(|| CompileError::from("no attribute 'template' found"))?; // Loop over the meta attributes and find everything that we // understand. Return a CompileError if something is not right. @@ -157,9 +157,10 @@ impl TemplateInput<'_> { let syntax = syntax.map_or_else( || Ok(config.syntaxes.get(config.default_syntax).unwrap()), |s| { - config.syntaxes.get(&s).ok_or_else(|| { - CompileError::String(format!("attribute syntax {} not exist", s)) - }) + config + .syntaxes + .get(&s) + .ok_or_else(|| CompileError::from(format!("attribute syntax {} not exist", s))) }, )?; @@ -181,7 +182,7 @@ impl TemplateInput<'_> { } let escaper = escaper.ok_or_else(|| { - CompileError::String(format!("no escaper defined for extension '{}'", escaping,)) + CompileError::from(format!("no escaper defined for extension '{}'", escaping)) })?; let mime_type = |