summaryrefslogtreecommitdiff
path: root/src/eval
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-10-07 19:28:34 +0200
committerLaurenz <laurmaedje@gmail.com>2020-10-07 19:28:34 +0200
commit13230db68c3cb2842f23f95fc1b47fd989e6277d (patch)
treeb0bf94a8e3f935a7e9076237783846dee14e3e81 /src/eval
parentd2e220245d9c17a0ac8c3474984924f65ed6b835 (diff)
Fix some clippy warnings ✔
Diffstat (limited to 'src/eval')
-rw-r--r--src/eval/mod.rs7
-rw-r--r--src/eval/scope.rs4
-rw-r--r--src/eval/value.rs6
3 files changed, 7 insertions, 10 deletions
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<String, ValueFunc>,
}
@@ -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
}
}