From 0a38903154befdc0bced4c3c9c4a9ad62feab771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Mon, 2 Jan 2023 18:23:12 +0100 Subject: [PATCH] I <3 CLIPPY --- src/ast.rs | 6 +++--- src/interpreter/value.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ast.rs b/src/ast.rs index 06f2bc4..4b7a2e7 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -206,7 +206,9 @@ impl AstDumper for ExprNode { arguments, } => { let callee = callee.dump(); - if arguments.len() > 0 { + if arguments.is_empty() { + format!("( call {} )", callee) + } else { format!( "( call {} {} )", callee, @@ -216,8 +218,6 @@ impl AstDumper for ExprNode { .collect::>() .join(" ") ) - } else { - format!("( call {} )", callee) } } } diff --git a/src/interpreter/value.rs b/src/interpreter/value.rs index bc425e2..f337910 100644 --- a/src/interpreter/value.rs +++ b/src/interpreter/value.rs @@ -28,8 +28,8 @@ impl Value { /// Check whether a value is truthy or not. pub fn is_truthy(&self) -> bool { match self { - &Self::Nil => false, - &Self::Boolean(b) => b, + Self::Nil => false, + Self::Boolean(b) => *b, _ => true, } }