From 2996198eff8de455937b5f3781b19518017935f0 Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 3 Jan 2017 02:41:22 -0800 Subject: [PATCH] lookup_binding only needs &str --- src/eval.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/eval.rs b/src/eval.rs index 9c9f8a2..70839f9 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -37,8 +37,8 @@ impl<'a> Evaluator<'a> { self.variables.insert(var, value); } - fn lookup_binding(&self, var: String) -> Option { - match self.variables.get(&var) { + fn lookup_binding(&self, var: &str) -> Option { + match self.variables.get(var) { Some(expr) => Some(expr.clone()), None => match self.parent { Some(env) => env.lookup_binding(var), @@ -158,7 +158,7 @@ impl<'a> Evaluator<'a> { e @ StringLiteral(_) => (e, None), e @ Number(_) => (e, None), e @ Lambda(_) => (e, None), - Variable(var) => { + Variable(ref var) => { match self.lookup_binding(var) { None => (Null, None), Some(expr) => (expr, None),