From a99f90b9765c9eb66a23f0eece72174e2301d648 Mon Sep 17 00:00:00 2001 From: Judy Wu Date: Tue, 20 Feb 2024 09:01:13 -0500 Subject: [PATCH] remove unnecessary use of list comprehension --- slither/tools/upgradeability/checks/variables_order.py | 8 ++++---- slither/utils/upgradeability.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/slither/tools/upgradeability/checks/variables_order.py b/slither/tools/upgradeability/checks/variables_order.py index fce0a09bb..8d525a6dd 100644 --- a/slither/tools/upgradeability/checks/variables_order.py +++ b/slither/tools/upgradeability/checks/variables_order.py @@ -115,8 +115,8 @@ Avoid variables in the proxy. If a variable is in the proxy, ensure it has the s def _check(self) -> List[Output]: contract1 = self._contract1() contract2 = self._contract2() - order1 = [variable for variable in contract1.stored_state_variables_ordered] - order2 = [variable for variable in contract2.stored_state_variables_ordered] + order1 = contract1.stored_state_variables_ordered + order2 = contract2.stored_state_variables_ordered results: List[Output] = [] for idx, _ in enumerate(order1): @@ -236,8 +236,8 @@ Avoid variables in the proxy. If a variable is in the proxy, ensure it has the s def _check(self) -> List[Output]: contract1 = self._contract1() contract2 = self._contract2() - order1 = [variable for variable in contract1.stored_state_variables_ordered] - order2 = [variable for variable in contract2.stored_state_variables_ordered] + order1 = contract1.stored_state_variables_ordered + order2 = contract2.stored_state_variables_ordered results = [] diff --git a/slither/utils/upgradeability.py b/slither/utils/upgradeability.py index e8300ba84..dd7bfe465 100644 --- a/slither/utils/upgradeability.py +++ b/slither/utils/upgradeability.py @@ -81,8 +81,8 @@ def compare( tainted-contracts: list[TaintedExternalContract] """ - order_vars1 = [v for v in v1.stored_state_variables_ordered] - order_vars2 = [v for v in v2.stored_state_variables_ordered] + order_vars1 = v1.stored_state_variables_ordered + order_vars2 = v2.stored_state_variables_ordered func_sigs1 = [function.solidity_signature for function in v1.functions] func_sigs2 = [function.solidity_signature for function in v2.functions] @@ -300,8 +300,8 @@ def get_missing_vars(v1: Contract, v2: Contract) -> List[StateVariable]: List of StateVariables from v1 missing in v2 """ results = [] - order_vars1 = [v for v in v1.stored_state_variables_ordered] - order_vars2 = [v for v in v2.stored_state_variables_ordered] + order_vars1 = v1.stored_state_variables_ordered + order_vars2 = v2.stored_state_variables_ordered if len(order_vars2) < len(order_vars1): for variable in order_vars1: if variable.name not in [v.name for v in order_vars2]: