diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-09-06 21:12:53 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-09-06 21:12:53 +0200 |
commit | 5503b945cc9ec274ae3d859330767e1088b13a52 (patch) | |
tree | 24e8fce1a38bb2fa69f5eb6038d6bc5144372122 /askama_shared/src/parser.rs | |
parent | f58e26c740db84b27c36d3c20a234ee31a24bd75 (diff) | |
download | askama-5503b945cc9ec274ae3d859330767e1088b13a52.tar.gz askama-5503b945cc9ec274ae3d859330767e1088b13a52.tar.bz2 askama-5503b945cc9ec274ae3d859330767e1088b13a52.zip |
Code cleanups as suggested by Clippy
Diffstat (limited to '')
-rw-r--r-- | askama_shared/src/parser.rs | 8 |
1 files changed, 4 insertions, 4 deletions
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<Vec<Expr>>, do_parse!( }) )) >> tag_s!(")") >> - (args.unwrap_or(Vec::new())) + (args.unwrap_or_default()) )); named!(parameters<Vec<&'a str>>, do_parse!( @@ -170,7 +170,7 @@ named!(parameters<Vec<&'a str>>, do_parse!( }) )) >> tag_s!(")") >> - (vals.unwrap_or(Vec::new())) + (vals.unwrap_or_default()) )); named!(expr_group<Expr>, map!( @@ -440,7 +440,7 @@ named!(parse_template<Vec<Node<'a>>>, many0!(alt!( pub fn parse(src: &str) -> Vec<Node> { 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 { |