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, } }