From f016b972fb7c20968842208540911271abb4b1ae Mon Sep 17 00:00:00 2001 From: ljedrz Date: Tue, 6 Oct 2020 10:01:44 +0200 Subject: [PATCH] clippy: fix vec_box Signed-off-by: ljedrz --- compiler/src/expression/array/array.rs | 4 ++-- typed/src/expression.rs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/compiler/src/expression/array/array.rs b/compiler/src/expression/array/array.rs index 22a15003dd..ed4283e8ee 100644 --- a/compiler/src/expression/array/array.rs +++ b/compiler/src/expression/array/array.rs @@ -37,7 +37,7 @@ impl> ConstrainedProgram { file_scope: String, function_scope: String, mut expected_type: Option, - array: Vec>, + array: Vec, span: Span, ) -> Result, ExpressionError> { // Check explicit array type dimension if given @@ -62,7 +62,7 @@ impl> ConstrainedProgram { 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()); diff --git a/typed/src/expression.rs b/typed/src/expression.rs index 5fc2543c1a..6037d9d1ad 100644 --- a/typed/src/expression.rs +++ b/typed/src/expression.rs @@ -92,7 +92,7 @@ pub enum Expression { // Arrays // (array_elements, span) - Array(Vec>, Span), + Array(Vec, Span), // (array_name, range, span) ArrayAccess(Box, Box, Span), @@ -506,7 +506,7 @@ impl<'ast> From> 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> for Expression { impl<'ast> From> 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> 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]; }