Skip to content

Unnecessary declaration repetition of continueLoop on each new iteration #12

Description

@samuraii77

We run the following loop:

    for (uint256 selectorIndex; selectorIndex < selectorCount; selectorIndex++) {
      ...
      bool continueLoop = false;
      ...
      for (uint256 facetIndex; facetIndex < numFacets; facetIndex++) {
        if (facets_[facetIndex].facetAddress == facetAddress_) {
         ....
          continueLoop = true;
          break;
        }
      }
      // If functionSelectors array exists for selector then continue loop
      if (continueLoop) {
        continueLoop = false;
        continue;
      }

      ...
    }

Each new iteration declares continueLoop again with the bool type. Instead, it is better to simply declare it outside the loop and change it accordingly on each iteration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions