mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-19 15:41:36 +03:00
clippy: fix vec_box
Signed-off-by: ljedrz <ljedrz@gmail.com>
This commit is contained in:
parent
70b87d331f
commit
f016b972fb
@ -37,7 +37,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
file_scope: String,
|
||||
function_scope: String,
|
||||
mut expected_type: Option<Type>,
|
||||
array: Vec<Box<SpreadOrExpression>>,
|
||||
array: Vec<SpreadOrExpression>,
|
||||
span: Span,
|
||||
) -> Result<ConstrainedValue<F, G>, ExpressionError> {
|
||||
// Check explicit array type dimension if given
|
||||
@ -62,7 +62,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
|
||||
let mut result = vec![];
|
||||
for element in array.into_iter() {
|
||||
match *element {
|
||||
match element {
|
||||
SpreadOrExpression::Spread(spread) => match spread {
|
||||
Expression::Identifier(identifier) => {
|
||||
let array_name = new_scope(function_scope.clone(), identifier.to_string());
|
||||
|
@ -92,7 +92,7 @@ pub enum Expression {
|
||||
|
||||
// Arrays
|
||||
// (array_elements, span)
|
||||
Array(Vec<Box<SpreadOrExpression>>, Span),
|
||||
Array(Vec<SpreadOrExpression>, Span),
|
||||
// (array_name, range, span)
|
||||
ArrayAccess(Box<Expression>, Box<RangeOrExpression>, Span),
|
||||
|
||||
@ -506,7 +506,7 @@ impl<'ast> From<ArrayInlineExpression<'ast>> for Expression {
|
||||
array
|
||||
.expressions
|
||||
.into_iter()
|
||||
.map(|s_or_e| Box::new(SpreadOrExpression::from(s_or_e)))
|
||||
.map(|s_or_e| SpreadOrExpression::from(s_or_e))
|
||||
.collect(),
|
||||
Span::from(array.span),
|
||||
)
|
||||
@ -516,7 +516,7 @@ impl<'ast> From<ArrayInlineExpression<'ast>> for Expression {
|
||||
impl<'ast> From<ArrayInitializerExpression<'ast>> for Expression {
|
||||
fn from(array: ArrayInitializerExpression<'ast>) -> Self {
|
||||
let dimensions = Expression::get_array_dimensions(array.dimensions);
|
||||
let expression = Box::new(SpreadOrExpression::from(*array.expression));
|
||||
let expression = SpreadOrExpression::from(*array.expression);
|
||||
|
||||
let mut elements = vec![];
|
||||
|
||||
@ -527,10 +527,10 @@ impl<'ast> From<ArrayInitializerExpression<'ast>> for Expression {
|
||||
if i == 0 {
|
||||
elements = vec![expression.clone(); dimension];
|
||||
} else {
|
||||
let element = Box::new(SpreadOrExpression::Expression(Expression::Array(
|
||||
let element = SpreadOrExpression::Expression(Expression::Array(
|
||||
elements,
|
||||
Span::from(array.span.clone()),
|
||||
)));
|
||||
));
|
||||
|
||||
elements = vec![element; dimension];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user