Remove compiler warnings

This commit is contained in:
greg 2018-10-20 00:55:37 -07:00
parent c25354b2c7
commit 4679a9fc7f
6 changed files with 10 additions and 9 deletions

View File

@ -45,7 +45,7 @@ impl Fold for RecursiveDescentFn {
} }
#[proc_macro_attribute] #[proc_macro_attribute]
pub fn recursive_descent_method(attr: TokenStream, item: TokenStream) -> TokenStream { pub fn recursive_descent_method(_attr: TokenStream, item: TokenStream) -> TokenStream {
let input: syn::ItemFn = parse_macro_input!(item as syn::ItemFn); let input: syn::ItemFn = parse_macro_input!(item as syn::ItemFn);
let mut folder = RecursiveDescentFn {}; let mut folder = RecursiveDescentFn {};

View File

@ -106,7 +106,7 @@ impl Expr {
UserDefined { name: Some(name), .. } => format!("<function '{}'>", name), UserDefined { name: Some(name), .. } => format!("<function '{}'>", name),
}, },
Expr::Constructor { Expr::Constructor {
type_name: _, name, tag, arity, type_name: _, name, arity, ..
} => if *arity == 0 { } => if *arity == 0 {
format!("{}", name) format!("{}", name)
} else { } else {
@ -208,7 +208,7 @@ impl<'a> State<'a> {
} }
} }
fn apply_data_constructor(&mut self, type_name: Rc<String>, name: Rc<String>, tag: usize, arity: usize, args: Vec<Expr>) -> EvalResult<Node> { fn apply_data_constructor(&mut self, _type_name: Rc<String>, name: Rc<String>, tag: usize, arity: usize, args: Vec<Expr>) -> EvalResult<Node> {
if arity != args.len() { if arity != args.len() {
return Err(format!("Data constructor {} requires {} args", name, arity)); return Err(format!("Data constructor {} requires {} args", name, arity));
} }
@ -353,7 +353,7 @@ impl<'a> State<'a> {
fn case_match_expression(&mut self, cond: Expr, alternatives: Vec<Alternative>) -> EvalResult<Node> { fn case_match_expression(&mut self, cond: Expr, alternatives: Vec<Alternative>) -> EvalResult<Node> {
match self.expression(Node::Expr(cond))? { match self.expression(Node::Expr(cond))? {
Node::PrimObject { name, tag, items } => { Node::PrimObject { tag, items, .. } => {
for alt in alternatives { for alt in alternatives {
if alt.tag.map(|t| t == tag).unwrap_or(true) { if alt.tag.map(|t| t == tag).unwrap_or(true) {
let mut inner_state = State { let mut inner_state = State {
@ -378,7 +378,7 @@ fn case_match_expression(&mut self, cond: Expr, alternatives: Vec<Alternative>)
return Err(format!("PrimObject failed pattern match")); return Err(format!("PrimObject failed pattern match"));
}, },
Node::PrimTuple { .. } => Err(format!("Tuples not implemented")), //TODO make a distinction between not yet implemented and an actual runtime error Node::PrimTuple { .. } => Err(format!("Tuples not implemented")), //TODO make a distinction between not yet implemented and an actual runtime error
Node::Expr(e) => { Node::Expr(_e) => {
for alt in alternatives { for alt in alternatives {
match (alt.guard, alt.tag) { match (alt.guard, alt.tag) {
(Some(ref guard_expr), None) => { (Some(ref guard_expr), None) => {

View File

@ -52,7 +52,7 @@ impl Schala {
} }
fn handle_custom_interpreter_directives(&mut self, commands: &Vec<&str>) -> Option<String> { fn handle_custom_interpreter_directives(&mut self, commands: &Vec<&str>) -> Option<String> {
Some(format!("You typed a command but I can't handle it")) Some(format!("Schala-lang command: {:?} not supported", commands.get(0)))
} }
} }

View File

@ -748,7 +748,7 @@ impl Parser {
let Expression(expr, _) = self.precedence_expr(precedence)?; let Expression(expr, _) = self.precedence_expr(precedence)?;
Guard::HalfExpr(HalfExpr { op: Some(op), expr }) Guard::HalfExpr(HalfExpr { op: Some(op), expr })
}, },
x => { _ => {
//TODO - I think there's a better way to do this involving the precedence of -> //TODO - I think there's a better way to do this involving the precedence of ->
let Expression(expr, _) = self.prefix_expr()?; let Expression(expr, _) = self.prefix_expr()?;
Guard::HalfExpr(HalfExpr { op: None, expr }) Guard::HalfExpr(HalfExpr { op: None, expr })

View File

@ -143,7 +143,7 @@ impl Expression {
fn reduce_if_expression(discriminator: &Discriminator, body: &IfExpressionBody, symbol_table: &SymbolTable) -> Expr { fn reduce_if_expression(discriminator: &Discriminator, body: &IfExpressionBody, symbol_table: &SymbolTable) -> Expr {
let cond = Box::new(match *discriminator { let cond = Box::new(match *discriminator {
Discriminator::Simple(ref expr) => expr.reduce(symbol_table), Discriminator::Simple(ref expr) => expr.reduce(symbol_table),
Discriminator::BinOp(ref expr, ref binop) => panic!("Can't yet handle binop discriminators") Discriminator::BinOp(ref _expr, ref _binop) => panic!("Can't yet handle binop discriminators")
}); });
match *body { match *body {
IfExpressionBody::SimpleConditional(ref then_clause, ref else_clause) => { IfExpressionBody::SimpleConditional(ref then_clause, ref else_clause) => {
@ -234,7 +234,7 @@ impl Pattern {
let symbol = symbol_table.lookup_by_name(name).expect(&format!("Symbol {} not found", name)); let symbol = symbol_table.lookup_by_name(name).expect(&format!("Symbol {} not found", name));
handle_symbol(symbol, subpatterns, item) handle_symbol(symbol, subpatterns, item)
}, },
TuplePattern(items) => { TuplePattern(_items) => {
unimplemented!() unimplemented!()
}, },
Record(_name, _pairs) => { Record(_name, _pairs) => {

View File

@ -35,6 +35,7 @@ impl<'a, T, V> ScopeStack<'a, T, V> where T: Hash + Eq {
scope_name: name, scope_name: name,
} }
} }
#[allow(dead_code)]
pub fn get_name(&self) -> Option<&String> { pub fn get_name(&self) -> Option<&String> {
self.scope_name.as_ref() self.scope_name.as_ref()
} }