From 4679a9fc7f0955dfbf94153a7a7ac0864efd3b2c Mon Sep 17 00:00:00 2001 From: greg Date: Sat, 20 Oct 2018 00:55:37 -0700 Subject: [PATCH] Remove compiler warnings --- schala-lang/codegen/src/lib.rs | 2 +- schala-lang/language/src/eval.rs | 8 ++++---- schala-lang/language/src/lib.rs | 2 +- schala-lang/language/src/parsing.rs | 2 +- schala-lang/language/src/reduced_ast.rs | 4 ++-- schala-lang/language/src/util.rs | 1 + 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/schala-lang/codegen/src/lib.rs b/schala-lang/codegen/src/lib.rs index 33a9c24..7647249 100644 --- a/schala-lang/codegen/src/lib.rs +++ b/schala-lang/codegen/src/lib.rs @@ -45,7 +45,7 @@ impl Fold for RecursiveDescentFn { } #[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 mut folder = RecursiveDescentFn {}; diff --git a/schala-lang/language/src/eval.rs b/schala-lang/language/src/eval.rs index 48c6d72..3fa5a6d 100644 --- a/schala-lang/language/src/eval.rs +++ b/schala-lang/language/src/eval.rs @@ -106,7 +106,7 @@ impl Expr { UserDefined { name: Some(name), .. } => format!("", name), }, Expr::Constructor { - type_name: _, name, tag, arity, + type_name: _, name, arity, .. } => if *arity == 0 { format!("{}", name) } else { @@ -208,7 +208,7 @@ impl<'a> State<'a> { } } - fn apply_data_constructor(&mut self, type_name: Rc, name: Rc, tag: usize, arity: usize, args: Vec) -> EvalResult { + fn apply_data_constructor(&mut self, _type_name: Rc, name: Rc, tag: usize, arity: usize, args: Vec) -> EvalResult { if arity != args.len() { 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) -> EvalResult { match self.expression(Node::Expr(cond))? { - Node::PrimObject { name, tag, items } => { + Node::PrimObject { tag, items, .. } => { for alt in alternatives { if alt.tag.map(|t| t == tag).unwrap_or(true) { let mut inner_state = State { @@ -378,7 +378,7 @@ fn case_match_expression(&mut self, cond: Expr, alternatives: Vec) 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::Expr(e) => { + Node::Expr(_e) => { for alt in alternatives { match (alt.guard, alt.tag) { (Some(ref guard_expr), None) => { diff --git a/schala-lang/language/src/lib.rs b/schala-lang/language/src/lib.rs index ee1e571..ba7f562 100644 --- a/schala-lang/language/src/lib.rs +++ b/schala-lang/language/src/lib.rs @@ -52,7 +52,7 @@ impl Schala { } fn handle_custom_interpreter_directives(&mut self, commands: &Vec<&str>) -> Option { - Some(format!("You typed a command but I can't handle it")) + Some(format!("Schala-lang command: {:?} not supported", commands.get(0))) } } diff --git a/schala-lang/language/src/parsing.rs b/schala-lang/language/src/parsing.rs index d55c48a..4aab248 100644 --- a/schala-lang/language/src/parsing.rs +++ b/schala-lang/language/src/parsing.rs @@ -748,7 +748,7 @@ impl Parser { let Expression(expr, _) = self.precedence_expr(precedence)?; Guard::HalfExpr(HalfExpr { op: Some(op), expr }) }, - x => { + _ => { //TODO - I think there's a better way to do this involving the precedence of -> let Expression(expr, _) = self.prefix_expr()?; Guard::HalfExpr(HalfExpr { op: None, expr }) diff --git a/schala-lang/language/src/reduced_ast.rs b/schala-lang/language/src/reduced_ast.rs index b47d710..15b5e18 100644 --- a/schala-lang/language/src/reduced_ast.rs +++ b/schala-lang/language/src/reduced_ast.rs @@ -143,7 +143,7 @@ impl Expression { fn reduce_if_expression(discriminator: &Discriminator, body: &IfExpressionBody, symbol_table: &SymbolTable) -> Expr { let cond = Box::new(match *discriminator { 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 { 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)); handle_symbol(symbol, subpatterns, item) }, - TuplePattern(items) => { + TuplePattern(_items) => { unimplemented!() }, Record(_name, _pairs) => { diff --git a/schala-lang/language/src/util.rs b/schala-lang/language/src/util.rs index d8bd74b..1df059b 100644 --- a/schala-lang/language/src/util.rs +++ b/schala-lang/language/src/util.rs @@ -35,6 +35,7 @@ impl<'a, T, V> ScopeStack<'a, T, V> where T: Hash + Eq { scope_name: name, } } + #[allow(dead_code)] pub fn get_name(&self) -> Option<&String> { self.scope_name.as_ref() }