diff --git a/src/eval.rs b/src/eval.rs index 911c65a..75d4520 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -31,9 +31,7 @@ pub struct Evaluator { impl Evaluator { pub fn new() -> Evaluator { - Evaluator { - frames: vec!(EnvFrame::new()), - } + Evaluator { frames: vec![EnvFrame::new()] } } pub fn run(&mut self, ast: AST) -> Vec { @@ -159,7 +157,7 @@ impl Evaluator { } FuncDefNode(func) => { let fn_name = func.prototype.name.clone(); - //TODO get rid of this clone + // TODO get rid of this clone self.add_function(fn_name, func.clone()); (ExprNode(Expression::Lambda(func)), None) } @@ -192,7 +190,7 @@ impl Evaluator { let binding = SideEffect::AddBinding(var, right); return (Null, Some(binding)); } - _ => return (Null, None) + _ => return (Null, None), } } @@ -228,7 +226,7 @@ impl Evaluator { } else { match else_block { Some(box expr) => (expr, None), - None => (Null, None) + None => (Null, None), } } } @@ -272,10 +270,7 @@ impl Evaluator { } } - fn reduce_call(&mut self, - name: String, - arguments: Vec) - -> Reduction { + fn reduce_call(&mut self, name: String, arguments: Vec) -> Reduction { use parser::Expression::*; // ugly hack for now diff --git a/src/parser.rs b/src/parser.rs index b7a6cc9..7a1c636 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -68,14 +68,9 @@ impl fmt::Display for Expression { &Null => write!(f, "null"), &StringLiteral(ref s) => write!(f, "\"{}\"", s), &Number(n) => write!(f, "{}", n), - &Lambda(Function { - prototype: Prototype { - ref name, - ref parameters, - .. - }, - .. - }) => write!(f, "«function: {}, {} arg(s)»", name, parameters.len()), + &Lambda(Function { prototype: Prototype { ref name, ref parameters, .. }, .. }) => { + write!(f, "«function: {}, {} arg(s)»", name, parameters.len()) + } _ => write!(f, "UNIMPLEMENTED"), } }