From 5503b945cc9ec274ae3d859330767e1088b13a52 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 6 Sep 2017 21:12:53 +0200 Subject: Code cleanups as suggested by Clippy --- askama_shared/src/parser.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'askama_shared/src/parser.rs') diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs index e74a194..5de964f 100644 --- a/askama_shared/src/parser.rs +++ b/askama_shared/src/parser.rs @@ -85,10 +85,10 @@ fn take_content(i: &[u8]) -> IResult<&[u8], Node> { for (idx, c) in i.iter().enumerate() { state = match (state, *c) { (Any, b'{') => Brace(idx), - (Any, _) => Any, (Brace(start), b'{') | (Brace(start), b'%') | (Brace(start), b'#') => End(start), + (Any, _) | (Brace(_), _) => Any, (End(_), _) => panic!("cannot happen"), }; @@ -151,7 +151,7 @@ named!(arguments>, do_parse!( }) )) >> tag_s!(")") >> - (args.unwrap_or(Vec::new())) + (args.unwrap_or_default()) )); named!(parameters>, do_parse!( @@ -170,7 +170,7 @@ named!(parameters>, do_parse!( }) )) >> tag_s!(")") >> - (vals.unwrap_or(Vec::new())) + (vals.unwrap_or_default()) )); named!(expr_group, map!( @@ -440,7 +440,7 @@ named!(parse_template>>, many0!(alt!( pub fn parse(src: &str) -> Vec { match parse_template(src.as_bytes()) { IResult::Done(left, res) => { - if left.len() > 0 { + if !left.is_empty() { let s = str::from_utf8(left).unwrap(); panic!("unable to parse template:\n\n{:?}", s); } else { -- cgit