Assorted cleanups as suggested by clippy

This commit is contained in:
Dirkjan Ochtman 2017-02-08 09:42:56 +01:00
parent d58ade7c8d
commit e1745be802
2 changed files with 3 additions and 3 deletions

View File

@ -312,7 +312,7 @@ pub fn generate(ast: &syn::DeriveInput, path: &str, mut nodes: Vec<Node>) -> Str
let mut gen = Generator::new(); let mut gen = Generator::new();
gen.path_based_name(ast, path); gen.path_based_name(ast, path);
if blocks.len() > 0 { if !blocks.is_empty() {
if let Some(extends) = base { if let Some(extends) = base {
if let Expr::StrLit(base_path) = extends { if let Expr::StrLit(base_path) = extends {
gen.trait_impl(ast, base_path, &blocks); gen.trait_impl(ast, base_path, &blocks);

View File

@ -68,7 +68,7 @@ fn expr_filtered(i: &[u8]) -> IResult<&[u8], Expr> {
}, },
}; };
} }
return IResult::Done(left, expr); IResult::Done(left, expr)
} }
named!(expr_compare<Expr>, do_parse!( named!(expr_compare<Expr>, do_parse!(
@ -159,7 +159,7 @@ named!(parse_template<Vec<Node<'a>>>, many0!(alt!(
block_extends | block_extends |
block_block))); block_block)));
pub fn parse<'a>(src: &'a str) -> Vec<Node<'a>> { pub fn parse(src: &str) -> Vec<Node> {
match parse_template(src.as_bytes()) { match parse_template(src.as_bytes()) {
IResult::Done(_, res) => res, IResult::Done(_, res) => res,
IResult::Error(err) => panic!("problems parsing template source: {}", err), IResult::Error(err) => panic!("problems parsing template source: {}", err),