From 6fa83bf79f76f2d3ab40d32498f684b55889e2ff Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Sun, 27 May 2018 10:30:53 +0200 Subject: Simplify code according to clippy suggestions --- askama_derive/src/generator.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index d309abd..5a01d7b 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -56,11 +56,8 @@ impl<'a> State<'a> { while check_nested < blocks.len() { if let Node::BlockDef(_, _, ref nodes, _) = blocks[check_nested] { for n in nodes { - match n { - def @ Node::BlockDef(_, _, _, _) => { - nested_blocks.push(def); - }, - _ => {}, + if let def @ Node::BlockDef(_, _, _, _) = n { + nested_blocks.push(def); } } } else { @@ -793,7 +790,7 @@ impl<'a> Generator<'a> { fn visit_method_call(&mut self, obj: &Expr, method: &str, args: &[Expr], code: &mut String) -> DisplayWrap { - if let &Expr::Var("self") = obj { + if let Expr::Var("self") = obj { code.push_str("self"); } else { self.visit_expr(obj, code); -- cgit