clean up codegen.rs
use std::cell::Cell;
use std::collections::HashMap;
-use std::mem::swap;
use std::vec::Vec;
pub struct CodeGenerator<'a, TermMarker> {
@@ -286,11 +285,8 @@ fn lco(code: &mut Code) -> usize
let mut dealloc_index = code.len() - 1;
match code.last_mut() {
- Some(&mut Line::Control(ref mut ctrl)) => {
- let mut instr = ControlInstruction::Proceed;
- swap(ctrl, &mut instr);
-
- match instr {
+ Some(&mut Line::Control(ref mut ctrl)) =>
+ match ctrl.clone() {
ControlInstruction::ArgCall =>
*ctrl = ControlInstruction::ArgExecute,
ControlInstruction::Call(name, arity, _) =>
@@ -313,7 +309,6 @@ fn lco(code: &mut Code) -> usize
*ctrl = ControlInstruction::IsExecute(r, at),
ControlInstruction::Proceed => {},
_ => dealloc_index += 1 // = code.len()
- }
},
Some(&mut Line::Cut(CutInstruction::Cut)) =>
dealloc_index += 1,
