private static boolean isUsedCompletely(PsiVariable variable, PsiLoopStatement loop) {
      return ContainerUtil.exists(VariableAccessUtils.getVariableReferences(variable, loop), expression -> {
        PsiElement parent = ExpressionUtils.getPassThroughParent(expression);
        if (parent instanceof PsiExpressionList ||
            parent instanceof PsiAssignmentExpression &&
            PsiTreeUtil.isAncestor(((PsiAssignmentExpression)parent).getRExpression(), expression, false)) {
          PsiStatement statement = PsiTreeUtil.getParentOfType(parent, PsiStatement.class);
          return !ControlFlowUtils.isExecutedOnceInLoop(statement, loop) && !ControlFlowUtils.isVariableReassigned(statement, variable);
        }
        return false;
      });
    }
private static boolean isUsedCompletely(PsiVariable variable, PsiLoopStatement loop)