Fix clippy lint about unnecessary boxing

This commit is contained in:
Tad Hardesty 2025-06-26 19:04:10 -07:00
parent ed90d86e8f
commit 8ef9761b8e

View file

@ -1434,7 +1434,7 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> {
// for(var/a = 1 to
require!(self.exact_ident("to"));
let rhs = require!(self.expression());
return spanned(require!(self.for_range(Some(vs.var_type), vs.name, Box::new(value), Box::new(rhs))));
return spanned(require!(self.for_range(Some(vs.var_type), vs.name, value, rhs)));
}
},
Statement::Expr(Expression::AssignOp {
@ -1449,7 +1449,7 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> {
};
require!(self.exact_ident("to"));
let to_rhs = require!(self.expression());
return spanned(require!(self.for_range(None, name, rhs, Box::new(to_rhs))));
return spanned(require!(self.for_range(None, name, *rhs, to_rhs)));
}
Statement::Expr(Expression::BinaryOp {
op: BinaryOp::In,
@ -1462,7 +1462,7 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> {
};
match *rhs {
Expression::BinaryOp { op: BinaryOp::To, lhs, rhs } => {
return spanned(require!(self.for_range(None, name, lhs, rhs)));
return spanned(require!(self.for_range(None, name, *lhs, *rhs)));
},
rhs => {
// I love code duplication, don't you?
@ -1495,7 +1495,7 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> {
let value = require!(self.expression());
if let Some(()) = self.exact_ident("to")? {
let rhs = require!(self.expression());
return spanned(require!(self.for_range(var_type, name, Box::new(value), Box::new(rhs))));
return spanned(require!(self.for_range(var_type, name, value, rhs)));
}
Some(value)
} else {
@ -1761,8 +1761,8 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> {
&mut self,
var_type: Option<VarType>,
name: Ident,
start: Box<Expression>,
end: Box<Expression>,
start: Expression,
end: Expression,
) -> Status<Statement> {
// step 2
let step = if let Some(()) = self.exact_ident("step")? {
@ -1776,8 +1776,8 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> {
success(Statement::ForRange(Box::new(ForRangeStatement {
var_type,
name: name.into(),
start: *start,
end: *end,
start,
end,
step,
block: require!(self.block(&LoopContext::ForRange)),
})))