aboutsummaryrefslogtreecommitdiffstats
path: root/askama_shared/src/parser.rs
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2021-01-20 09:33:17 +0100
committerLibravatar Christian Vallentin <vallentinsource@gmail.com>2021-01-22 19:55:45 +0100
commit95e346e55f519410cc0203879a1db49da7c2a7d3 (patch)
tree428d6c05f9063efddc5853d60d769bae971de445 /askama_shared/src/parser.rs
parentefa42285e318a253b131fb335fc84ad6679fac44 (diff)
downloadaskama-95e346e55f519410cc0203879a1db49da7c2a7d3.tar.gz
askama-95e346e55f519410cc0203879a1db49da7c2a7d3.tar.bz2
askama-95e346e55f519410cc0203879a1db49da7c2a7d3.zip
Apply suggestions from nightly clippy
Diffstat (limited to '')
-rw-r--r--askama_shared/src/parser.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs
index 2b8e8f0..9aec56e 100644
--- a/askama_shared/src/parser.rs
+++ b/askama_shared/src/parser.rs
@@ -673,8 +673,7 @@ fn expr_any(i: &[u8]) -> IResult<&[u8], Expr> {
Expr::Range(op, _, right) => Expr::Range(op, Some(Box::new(left)), right),
_ => unreachable!(),
});
- let mut p = alt((range_right, compound, expr_or));
- Ok(p(i)?)
+ alt((range_right, compound, expr_or))(i)
}
fn expr_node<'a>(i: &'a [u8], s: &'a Syntax<'a>) -> IResult<&'a [u8], Node<'a>> {
@@ -740,8 +739,7 @@ fn block_if<'a>(i: &'a [u8], s: &'a Syntax<'a>) -> IResult<&'a [u8], Node<'a>> {
));
let (i, (pws1, cond, nws1, _, block, elifs, _, pws2, _, nws2)) = p(i)?;
- let mut res = Vec::new();
- res.push((WS(pws1.is_some(), nws1.is_some()), Some(cond), block));
+ let mut res = vec![(WS(pws1.is_some(), nws1.is_some()), Some(cond), block)];
res.extend(elifs);
Ok((i, Node::Cond(res, WS(pws2.is_some(), nws2.is_some()))))
}