From 95e346e55f519410cc0203879a1db49da7c2a7d3 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 20 Jan 2021 09:33:17 +0100 Subject: Apply suggestions from nightly clippy --- askama_shared/src/parser.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'askama_shared/src') 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())))) } -- cgit