diff --git a/src/interpreter/interpretable.rs b/src/interpreter/interpretable.rs index d411500..0ada858 100644 --- a/src/interpreter/interpretable.rs +++ b/src/interpreter/interpretable.rs @@ -33,7 +33,7 @@ impl<'a> InterpreterState<'a> { Self { environment: env.clone(), globals: env, - locals: &locals, + locals, } } diff --git a/src/resolver.rs b/src/resolver.rs index 824c96c..667ad97 100644 --- a/src/resolver.rs +++ b/src/resolver.rs @@ -76,11 +76,10 @@ impl<'a> ResolverState<'a> { self.scopes[self.scopes.len() - 1] .values() .filter(|v| v.state != SymState::Used) - .filter(|v| !v.decl.lexeme.starts_with("_")) - .nth(0) + .find(|v| !v.decl.lexeme.starts_with('_')) .map_or(Ok(()), |v| { self.error( - &v.decl, + v.decl, "unused symbol; prefix its name with '_' to avoid this error", ) })