Skip to content

Commit 0146e5f

Browse files
committed
Remove unnecessary dereferences/references in compiler
It's not necessary to dereference a reference to then take a reference again, at least not in these cases, so we can remove them.
1 parent 0f87d15 commit 0146e5f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

vm/src/compile.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -838,21 +838,21 @@ impl Compiler {
838838
self.compile_test(expression, None, None, EvalContext::Expression)?
839839
}
840840
ast::Expression::Binop { a, op, b } => {
841-
self.compile_expression(&*a)?;
842-
self.compile_expression(&*b)?;
841+
self.compile_expression(a)?;
842+
self.compile_expression(b)?;
843843

844844
// Perform operation:
845845
self.compile_op(op);
846846
}
847847
ast::Expression::Subscript { a, b } => {
848-
self.compile_expression(&*a)?;
849-
self.compile_expression(&*b)?;
848+
self.compile_expression(a)?;
849+
self.compile_expression(b)?;
850850
self.emit(Instruction::BinaryOperation {
851851
op: bytecode::BinaryOperator::Subscript,
852852
});
853853
}
854854
ast::Expression::Unop { op, a } => {
855-
self.compile_expression(&*a)?;
855+
self.compile_expression(a)?;
856856

857857
// Perform operation:
858858
let i = match op {
@@ -865,14 +865,14 @@ impl Compiler {
865865
self.emit(i);
866866
}
867867
ast::Expression::Attribute { value, name } => {
868-
self.compile_expression(&*value)?;
868+
self.compile_expression(value)?;
869869
self.emit(Instruction::LoadAttr {
870870
name: name.to_string(),
871871
});
872872
}
873873
ast::Expression::Compare { a, op, b } => {
874-
self.compile_expression(&*a)?;
875-
self.compile_expression(&*b)?;
874+
self.compile_expression(a)?;
875+
self.compile_expression(b)?;
876876

877877
let i = match op {
878878
ast::Comparison::Equal => bytecode::ComparisonOperator::Equal,

0 commit comments

Comments
 (0)