diff --git a/schala-lang/language/src/ast/visualize.rs b/schala-lang/language/src/ast/visualize.rs index a6c312e..5957cbf 100644 --- a/schala-lang/language/src/ast/visualize.rs +++ b/schala-lang/language/src/ast/visualize.rs @@ -1,3 +1,4 @@ +#![allow(clippy::single_char_add_str)] use super::{ Block, Declaration, Expression, ExpressionKind, ImportSpecifier, InvocationArgument, ModuleSpecifier, Signature, Statement, StatementKind, AST, @@ -18,8 +19,8 @@ fn newline(buf: &mut String) { pub(super) fn render_ast(ast: &AST) -> String { let AST { statements, .. } = ast; - let mut buf = format!("(AST\n"); - render_block(&statements, LEVEL, &mut buf); + let mut buf = "(AST\n".to_string(); + render_block(statements, LEVEL, &mut buf); buf.push(')'); @@ -168,12 +169,12 @@ fn render_declaration(decl: &Declaration, indent: usize, buf: &mut String) { */ } do_indent(indent, buf); - buf.push_str(")"); + buf.push(')'); } fn render_block(block: &Block, indent: usize, buf: &mut String) { for stmt in block.statements.iter() { - render_statement(&stmt, indent, buf); + render_statement(stmt, indent, buf); newline(buf); } } diff --git a/schala-lang/language/src/symbol_table/resolver.rs b/schala-lang/language/src/symbol_table/resolver.rs index b589399..3ea516c 100644 --- a/schala-lang/language/src/symbol_table/resolver.rs +++ b/schala-lang/language/src/symbol_table/resolver.rs @@ -161,7 +161,7 @@ impl<'a> ASTVisitor for ScopeResolver<'a> { let mut new_scope = ScopeStack::new(Some(ScopeType::Function { name: signature.name.clone() })); - for (n, param) in param_names.enumerate().into_iter() { + for (n, param) in param_names.enumerate() { new_scope.insert(param, NameType::Param(n as u8)); } @@ -198,7 +198,7 @@ impl<'a> ASTVisitor for ScopeResolver<'a> { //let mut new_scope = self.lexical_scopes.new_scope(Some(ScopeType::Function { name: signature.name.clone() })); let mut new_scope = ScopeStack::new(Some(ScopeType::Lambda)); - for (n, param) in param_names.enumerate().into_iter() { + for (n, param) in param_names.enumerate() { new_scope.insert(param, NameType::Param(n as u8)); } diff --git a/schala-lang/language/src/tree_walk_eval/evaluator.rs b/schala-lang/language/src/tree_walk_eval/evaluator.rs index 1d6adf8..8beabc5 100644 --- a/schala-lang/language/src/tree_walk_eval/evaluator.rs +++ b/schala-lang/language/src/tree_walk_eval/evaluator.rs @@ -25,7 +25,7 @@ impl<'a, 'b> Evaluator<'a, 'b> { for statement in reduced.entrypoint.into_iter() { match self.statement(statement) { - Ok(Some(output)) if repl => acc.push(Ok(output.to_repl(&self.type_context))), + Ok(Some(output)) if repl => acc.push(Ok(output.to_repl(self.type_context))), Ok(_) => (), Err(error) => { acc.push(Err(error.msg)); diff --git a/schala-lang/language/src/tree_walk_eval/mod.rs b/schala-lang/language/src/tree_walk_eval/mod.rs index af443d8..6e0fda1 100644 --- a/schala-lang/language/src/tree_walk_eval/mod.rs +++ b/schala-lang/language/src/tree_walk_eval/mod.rs @@ -137,8 +137,7 @@ impl Primitive { ) } Primitive::Object { type_id, items, tag, ordered_fields: Some(fields) } => { - let mut buf = format!("{}", type_context.variant_local_name(type_id, *tag).unwrap()); - write!(buf, " {{ ").unwrap(); + let mut buf = format!("{} {{ ", type_context.variant_local_name(type_id, *tag).unwrap()); for item in fields.iter().zip(items.iter()).map(Some).intersperse(None) { match item { Some((name, val)) => write!(buf, "{}: {}", name, val.to_repl(type_context)).unwrap(),