From 6252bed605553581fd88896588b42ea745293136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Sat, 7 Jan 2023 11:59:32 +0100 Subject: [PATCH] Happy clippy is happy (and Clippy) --- src/interpreter/interpretable.rs | 2 +- src/resolver.rs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) 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", ) })