From 1a3d1fb2b8f6da125b048ad0cb44e67fafd54c7a Mon Sep 17 00:00:00 2001 From: ljedrz Date: Tue, 6 Oct 2020 11:07:21 +0200 Subject: [PATCH] clippy: fix collapsible_if Signed-off-by: ljedrz --- compiler/src/expression/array/array.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/compiler/src/expression/array/array.rs b/compiler/src/expression/array/array.rs index ed4283e8ee..578c005bf4 100644 --- a/compiler/src/expression/array/array.rs +++ b/compiler/src/expression/array/array.rs @@ -89,14 +89,12 @@ impl> ConstrainedProgram { } // Check expected_dimensions if given - if !expected_dimensions.is_empty() { - if expected_dimensions[expected_dimensions.len() - 1] != result.len() { - return Err(ExpressionError::invalid_length( - expected_dimensions[expected_dimensions.len() - 1], - result.len(), - span, - )); - } + if !expected_dimensions.is_empty() && expected_dimensions[expected_dimensions.len() - 1] != result.len() { + return Err(ExpressionError::invalid_length( + expected_dimensions[expected_dimensions.len() - 1], + result.len(), + span, + )); } Ok(ConstrainedValue::Array(result))