Made Clippy slightly less unhappy

This commit is contained in:
Emmanuel BENOîT 2023-01-08 15:27:19 +01:00
parent 1c5efe7e62
commit 2b4ecf6d2c

View file

@ -70,7 +70,7 @@ fn dump_statement(dumper: &mut Dumper, stmt: &StmtNode) {
dumper.depth -= 1; dumper.depth -= 1;
dumper.add_line(String::default()); dumper.add_line(String::default());
} }
dumper.current_line().push_str("}"); dumper.current_line().push('}');
} }
StmtNode::ClassDecl(decl) => { StmtNode::ClassDecl(decl) => {
@ -91,7 +91,7 @@ fn dump_statement(dumper: &mut Dumper, stmt: &StmtNode) {
dumper.depth -= 1; dumper.depth -= 1;
dumper.add_line(String::default()); dumper.add_line(String::default());
} }
dumper.current_line().push_str("}"); dumper.current_line().push('}');
} }
StmtNode::Expression(expr) => { StmtNode::Expression(expr) => {
@ -197,9 +197,9 @@ fn dump_expr_node(dumper: &mut Dumper, expr: &ExprNode) {
right, right,
} => { } => {
dump_expr_node(dumper, left); dump_expr_node(dumper, left);
dumper.current_line().push_str(" "); dumper.current_line().push(' ');
dumper.current_line().push_str(&operator.lexeme); dumper.current_line().push_str(&operator.lexeme);
dumper.current_line().push_str(" "); dumper.current_line().push(' ');
dump_expr_node(dumper, right); dump_expr_node(dumper, right);
} }
@ -209,9 +209,9 @@ fn dump_expr_node(dumper: &mut Dumper, expr: &ExprNode) {
right, right,
} => { } => {
dump_expr_node(dumper, left); dump_expr_node(dumper, left);
dumper.current_line().push_str(" "); dumper.current_line().push(' ');
dumper.current_line().push_str(&operator.lexeme); dumper.current_line().push_str(&operator.lexeme);
dumper.current_line().push_str(" "); dumper.current_line().push(' ');
dump_expr_node(dumper, right); dump_expr_node(dumper, right);
} }
@ -221,9 +221,9 @@ fn dump_expr_node(dumper: &mut Dumper, expr: &ExprNode) {
} }
ExprNode::Grouping { expression } => { ExprNode::Grouping { expression } => {
dumper.current_line().push_str("("); dumper.current_line().push('(');
dump_expr_node(dumper, expression); dump_expr_node(dumper, expression);
dumper.current_line().push_str(")"); dumper.current_line().push(')');
} }
ExprNode::Litteral { value } => { ExprNode::Litteral { value } => {
@ -245,7 +245,7 @@ fn dump_expr_node(dumper: &mut Dumper, expr: &ExprNode) {
dumper.add_line(String::default()); dumper.add_line(String::default());
dumper.depth -= 1; dumper.depth -= 1;
} }
dumper.current_line().push_str("}"); dumper.current_line().push('}');
} }
ExprNode::Call { ExprNode::Call {
@ -254,14 +254,14 @@ fn dump_expr_node(dumper: &mut Dumper, expr: &ExprNode) {
arguments, arguments,
} => { } => {
dump_expr_node(dumper, callee); dump_expr_node(dumper, callee);
dumper.current_line().push_str("("); dumper.current_line().push('(');
for (i, argument) in arguments.iter().enumerate() { for (i, argument) in arguments.iter().enumerate() {
dump_expr_node(dumper, argument); dump_expr_node(dumper, argument);
if arguments.len() - 1 > i { if arguments.len() - 1 > i {
dumper.current_line().push_str(", "); dumper.current_line().push_str(", ");
} }
} }
dumper.current_line().push_str(")"); dumper.current_line().push(')');
} }
ExprNode::Get(_) => todo!(), ExprNode::Get(_) => todo!(),