From 87024b79ba6c6787d2cff0a56d588e050fb1ee2b Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Sun, 31 Oct 2021 02:44:33 -0700 Subject: [PATCH] Clippy --- schala-lang/language/src/parsing/mod.rs | 15 +++++---------- schala-lang/language/src/reduced_ir/mod.rs | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/schala-lang/language/src/parsing/mod.rs b/schala-lang/language/src/parsing/mod.rs index 329c70c..24912ae 100644 --- a/schala-lang/language/src/parsing/mod.rs +++ b/schala-lang/language/src/parsing/mod.rs @@ -394,14 +394,14 @@ impl Parser { let tok = self.token_handler.peek(); let kind = match tok.get_kind() { AtSign => self.annotation().map(StatementKind::Declaration), - Keyword(Type) => self.type_declaration().map(|decl| StatementKind::Declaration(decl)), - Keyword(Func) => self.func_declaration().map(|func| StatementKind::Declaration(func)), + Keyword(Type) => self.type_declaration().map(StatementKind::Declaration), + Keyword(Func) => self.func_declaration().map(StatementKind::Declaration), Keyword(Let) => self.binding_declaration().map(StatementKind::Declaration), Keyword(Interface) => self.interface_declaration().map(StatementKind::Declaration), Keyword(Impl) => self.impl_declaration().map(StatementKind::Declaration), Keyword(Import) => self.import_declaration().map(StatementKind::Import), Keyword(Module) => self.module_declaration().map(StatementKind::Module), - _ => self.expression().map(|expr| StatementKind::Expression(expr)), + _ => self.expression().map(StatementKind::Expression), }?; let id = self.id_store.fresh(); Ok(Statement { kind, id, location: tok.location }) @@ -693,13 +693,8 @@ impl Parser { #[recursive_descent_method] fn prefix_expr(&mut self) -> ParseResult { - loop { - match self.token_handler.peek_kind() { - Semicolon | Newline => { - self.token_handler.next(); - } - _ => break, - } + while let Semicolon | Newline = self.token_handler.peek_kind() { + self.token_handler.next(); } match self.token_handler.peek_kind() { diff --git a/schala-lang/language/src/reduced_ir/mod.rs b/schala-lang/language/src/reduced_ir/mod.rs index de1ae45..d5dad04 100644 --- a/schala-lang/language/src/reduced_ir/mod.rs +++ b/schala-lang/language/src/reduced_ir/mod.rs @@ -142,7 +142,7 @@ impl<'a, 'b> Reducer<'a, 'b> { e => return Expression::ReductionError(format!("Bad symbol for NamedStruct: {:?}", e)), }; - let field_order = compute_field_orderings(&self.type_context, &type_id, tag).unwrap(); + let field_order = compute_field_orderings(self.type_context, &type_id, tag).unwrap(); let mut field_map = HashMap::new(); for (name, expr) in fields.iter() {