From e4c652b2404177078c7a00506c22cd2aa6773a9a Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Tue, 20 Aug 2019 12:57:02 -0500 Subject: [PATCH] MAINT: Unused variable code cleanup --- src/build/opcode/runtime.rs | 18 +++++++++--------- src/build/opcode/scope.rs | 3 +-- src/build/opcode/vm.rs | 3 +-- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/build/opcode/runtime.rs b/src/build/opcode/runtime.rs index 546cea7..195ed83 100644 --- a/src/build/opcode/runtime.rs +++ b/src/build/opcode/runtime.rs @@ -411,7 +411,7 @@ impl Builtins { // push function argument on the stack. stack.push((e.clone(), list_pos.clone())); // call function and push it's result on the stack. - let (result, _) = VM::fcall_impl(f, stack, env.clone(), &pos)?; + let (result, _) = VM::fcall_impl(f, stack, env.clone())?; result_elems.push(result); } stack.push((Rc::new(C(List(result_elems))), list_pos)); @@ -421,7 +421,7 @@ impl Builtins { for (ref name, ref val) in _flds { stack.push((val.clone(), list_pos.clone())); stack.push((Rc::new(P(Str(name.clone()))), list_pos.clone())); - let (result, result_pos) = VM::fcall_impl(f, stack, env.clone(), &fptr_pos)?; + let (result, result_pos) = VM::fcall_impl(f, stack, env.clone())?; if let &C(List(ref fval)) = result.as_ref() { // we expect them to be a list of exactly 2 items. if fval.len() != 2 { @@ -449,7 +449,7 @@ impl Builtins { for c in s.chars() { stack.push((Rc::new(P(Str(c.to_string()))), list_pos.clone())); // call function and push it's result on the stack. - let (result, result_pos) = VM::fcall_impl(f, stack, env.clone(), &fptr_pos)?; + let (result, result_pos) = VM::fcall_impl(f, stack, env.clone())?; if let &P(Str(ref s)) = result.as_ref() { buf.push_str(s); } else { @@ -507,7 +507,7 @@ impl Builtins { // push function argument on the stack. stack.push((e.clone(), list_pos.clone())); // call function and push it's result on the stack. - let (condition, _) = VM::fcall_impl(f, stack, env.clone(), &fptr_pos)?; + let (condition, _) = VM::fcall_impl(f, stack, env.clone())?; // Check for empty or boolean results and only push e back in // if they are non empty and true match condition.as_ref() { @@ -524,7 +524,7 @@ impl Builtins { for (ref name, ref val) in _flds { stack.push((val.clone(), list_pos.clone())); stack.push((Rc::new(P(Str(name.clone()))), list_pos.clone())); - let (condition, _) = VM::fcall_impl(f, stack, env.clone(), &pos)?; + let (condition, _) = VM::fcall_impl(f, stack, env.clone())?; // Check for empty or boolean results and only push e back in // if they are non empty and true match condition.as_ref() { @@ -541,7 +541,7 @@ impl Builtins { for c in s.chars() { stack.push((Rc::new(P(Str(c.to_string()))), list_pos.clone())); // call function and push it's result on the stack. - let (condition, _) = VM::fcall_impl(f, stack, env.clone(), &pos)?; + let (condition, _) = VM::fcall_impl(f, stack, env.clone())?; // Check for empty or boolean results and only push c back in // if they are non empty and true match condition.as_ref() { @@ -640,7 +640,7 @@ impl Builtins { stack.push((dbg!(e.clone()), list_pos.clone())); stack.push((dbg!(acc.clone()), acc_pos.clone())); // call function and push it's result on the stack. - let (new_acc, new_acc_pos) = VM::fcall_impl(f, stack, env.clone(), &fptr_pos)?; + let (new_acc, new_acc_pos) = VM::fcall_impl(f, stack, env.clone())?; acc = new_acc; acc_pos = new_acc_pos; } @@ -652,7 +652,7 @@ impl Builtins { stack.push((Rc::new(P(Str(name.clone()))), list_pos.clone())); stack.push((dbg!(acc.clone()), acc_pos.clone())); // call function and push it's result on the stack. - let (new_acc, new_acc_pos) = VM::fcall_impl(f, stack, env.clone(), &fptr_pos)?; + let (new_acc, new_acc_pos) = VM::fcall_impl(f, stack, env.clone())?; acc = new_acc; acc_pos = new_acc_pos; } @@ -663,7 +663,7 @@ impl Builtins { stack.push((dbg!(Rc::new(P(Str(c.to_string())))), list_pos.clone())); stack.push((dbg!(acc.clone()), acc_pos.clone())); // call function and push it's result on the stack. - let (new_acc, new_acc_pos) = VM::fcall_impl(f, stack, env.clone(), &fptr_pos)?; + let (new_acc, new_acc_pos) = VM::fcall_impl(f, stack, env.clone())?; acc = new_acc; acc_pos = new_acc_pos; } diff --git a/src/build/opcode/scope.rs b/src/build/opcode/scope.rs index 616d742..0a2033f 100644 --- a/src/build/opcode/scope.rs +++ b/src/build/opcode/scope.rs @@ -11,8 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -use std::collections::{BTreeMap, BTreeSet}; -use std::iter::FromIterator; +use std::collections::BTreeMap; use std::rc::Rc; use super::Value; diff --git a/src/build/opcode/vm.rs b/src/build/opcode/vm.rs index d32b539..acc5c8e 100644 --- a/src/build/opcode/vm.rs +++ b/src/build/opcode/vm.rs @@ -370,7 +370,6 @@ where f: &Func, stack: &mut Vec<(Rc, Position)>, env: Rc>>, - pos: &Position, ) -> Result<(Rc, Position), Error> { let Func { ref ptr, @@ -404,7 +403,7 @@ where fn op_fcall(&mut self, pos: Position) -> Result<(), Error> { let (f, _) = dbg!(self.pop())?; if let &F(ref f) = f.as_ref() { - let (val, _) = Self::fcall_impl(f, &mut self.stack, self.env.clone(), &pos)?; + let (val, _) = Self::fcall_impl(f, &mut self.stack, self.env.clone())?; self.push(dbg!(val), pos.clone())?; } Ok(())