private static boolean isAssignmentToVariable(PsiElement element, PsiLocalVariable variable) {
      if (!(element instanceof PsiExpressionStatement expressionStatement)) {
        return false;
      }
      final PsiExpression expression = expressionStatement.getExpression();
      if (!(expression instanceof PsiAssignmentExpression assignmentExpression)) {
        return false;
      }
      final IElementType tokenType = assignmentExpression.getOperationTokenType();
      if (tokenType != JavaTokenType.EQ) {
        return false;
      }
      final PsiExpression lhs = assignmentExpression.getLExpression();
      if (!ExpressionUtils.isReferenceTo(lhs, variable)) {
        return false;
      }
      final PsiExpression rhs = assignmentExpression.getRExpression();
      return rhs == null || !VariableAccessUtils.variableIsUsed(variable, rhs);
    }
private static boolean isAssignmentToVariable(PsiElement element, PsiLocalVariable variable)