Next-generation intensity-modulation (IM) and direct-detection (DD) systems used in data centers are expected to operate at 400 Gb/s/lane and beyond. Such rates can be achieved by increasing the system bandwidth or the modulation format, which in turn requires maintaining or increasing the signal-to-noise ratio (SNR). Such SNR requirements can be achieved by increasing the transmitted optical power. This increase in optical power causes the emergence of relative intensity noise (RIN), a signal-dependent impairment inherent to the transmitter laser, which ultimately limits the performance of the system. In this paper, we develop an analytical symbol error rate (SER) expression for the optimal detector for the IM-DD optical link under study. The developed expression takes into account the signal-dependent nature of RIN and does not make any assumptions on the geometry or probability distribution of the constellation. Our expression is therefore applicable to general probabilistically and/or geometrically shaped systems. Unlike results available in the literature, our proposed expression provides a perfect match to numerical simulations of probabilistic and geometrically shaped systems.