From 13230db68c3cb2842f23f95fc1b47fd989e6277d Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 7 Oct 2020 19:28:34 +0200 Subject: =?UTF-8?q?Fix=20some=20clippy=20warnings=20=E2=9C=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/eval/mod.rs | 7 +++---- src/eval/scope.rs | 4 ++-- src/eval/value.rs | 6 ++---- 3 files changed, 7 insertions(+), 10 deletions(-) (limited to 'src/eval') diff --git a/src/eval/mod.rs b/src/eval/mod.rs index c7d9c2a6..2c6f4d7c 100644 --- a/src/eval/mod.rs +++ b/src/eval/mod.rs @@ -421,11 +421,10 @@ impl Eval for ExprUnary { type Output = Value; fn eval(&self, ctx: &mut EvalContext) -> Self::Output { - use Value::*; - let value = self.expr.v.eval(ctx); - if value == Error { - return Error; + + if let Value::Error = value { + return Value::Error; } let span = self.op.span.join(self.expr.span); diff --git a/src/eval/scope.rs b/src/eval/scope.rs index fc530bbb..c0624393 100644 --- a/src/eval/scope.rs +++ b/src/eval/scope.rs @@ -6,7 +6,7 @@ use std::fmt::{self, Debug, Formatter}; use super::value::ValueFunc; /// A map from identifiers to functions. -#[derive(Clone, PartialEq)] +#[derive(Default, Clone, PartialEq)] pub struct Scope { functions: HashMap, } @@ -15,7 +15,7 @@ impl Scope { // Create a new empty scope with a fallback function that is invoked when no // match is found. pub fn new() -> Self { - Self { functions: HashMap::new() } + Self::default() } /// Return the function with the given name if there is one. diff --git a/src/eval/value.rs b/src/eval/value.rs index 8eea90df..c4b11ebe 100644 --- a/src/eval/value.rs +++ b/src/eval/value.rs @@ -157,11 +157,9 @@ impl ValueFunc { } } -impl Eq for ValueFunc {} - impl PartialEq for ValueFunc { - fn eq(&self, other: &Self) -> bool { - Rc::ptr_eq(&self.0, &other.0) + fn eq(&self, _: &Self) -> bool { + false } } -- cgit v1.2.3