From fdaf4c302ca97717cf7cdcbd081437e3c2a2b0e1 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 17 Jan 2016 00:16:01 -0800 Subject: [PATCH] Fix all compiler warnings --- src/main.rs | 4 ++-- src/parser.rs | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3a99a90..9640465 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -#![feature(advanced_slice_patterns, slice_patterns, box_attributes, box_patterns)] +#![feature(advanced_slice_patterns, slice_patterns, box_patterns)] extern crate simplerepl; @@ -11,7 +11,7 @@ use simplerepl::{REPL, ReplState}; use tokenizer::tokenize; mod tokenizer; -use parser::{parse, ParseResult}; +use parser::{parse}; mod parser; fn main() { diff --git a/src/parser.rs b/src/parser.rs index 5206818..63f05f0 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -122,7 +122,6 @@ fn is_delimiter(token: &Token) -> bool { impl Parser { fn program(&mut self) -> ParseResult { - use tokenizer::Token::*; let mut ast = Vec::new(); //TODO have this come from previously-parsed tree loop { let cur_tok = match self.peek() { @@ -168,7 +167,7 @@ impl Parser { use tokenizer::Token::*; let name: String = expect_identifier!(self); expect!(self, LParen, "Expected '('"); - let mut args: Vec = try!(self.identlist()); + let args: Vec = try!(self.identlist()); expect!(self, RParen, "Expected ')'"); Ok(Prototype {name: name, args: args}) } @@ -230,7 +229,6 @@ impl Parser { } fn expression(&mut self) -> ParseResult { - use tokenizer::Token::*; let lhs: Expression = try!(self.primary_expression()); self.precedence_expr(lhs, 0) } @@ -265,9 +263,9 @@ impl Parser { let expr = match self.peek() { Some(NumLiteral(n)) => { self.next(); Expression::Number(n) }, Some(StrLiteral(s)) => { self.next(); Expression::StringLiteral(s) }, - Some(Identifier(var)) => { try!(self.identifier_expr()) }, + Some(Identifier(_)) => { try!(self.identifier_expr()) }, Some(Token::LParen) => { try!(self.paren_expr()) } - Some(x) => return ParseError::result_from_str("Expected primary expression"), + Some(_) => return ParseError::result_from_str("Expected primary expression"), None => return ParseError::result_from_str("Expected primary expression received EoI") }; @@ -291,7 +289,7 @@ impl Parser { fn call_expr(&mut self) -> ParseResult> { use tokenizer::Token::*; expect!(self, LParen, "Expected '('"); - let mut args: Vec = try!(self.exprlist()); + let args: Vec = try!(self.exprlist()); expect!(self, RParen, "Expected ')'"); Ok(args) }