Why does the fact that $f$ and $g$ have the same Fourier coefficients imply that $f=g\text{ a.e.} $ I am self-learning Rudin's RCA and I encountered a puzzle that struggled me for a long time. Here is the related text from RCA and my question.

Suppose now that $f\in L^1(T)$, that $\{c_n\}$ is given by $ c_n = \frac{1}{2\pi} \int_{-\pi}^\pi f(x)e^{-inx} \, dx$, and that $\sum_{-\infty}^\infty |c_n|<\infty$. Put $g(x)=\sum_{-\infty}^\infty c_n e^{inx}$.
We can get that the series $g(x)$ converges uniformly by  $\sum_{-\infty}^\infty |c_n|<\infty$ (hence $g$ is continuous), and the Fourier coefficients of $g$ are easily computed. Through the computation, we know that $f$ and $g$ have the same Fourier coefficients. This implies $f=g\text{ a.e.}$, so the Fourier series of $f$ converges to $f(x)\text{ a.e.}$

My question is in the very last line: why the fact that the Fourier coefficients of $f$ and $g$ are equal implies that $f=g\text{ a.e.}$?
Guess 1: I am aware that if $f$ and $g$ are continuous, then this implication can follow. So, we may use that $C(T)$ is dense in $L^1(T)$ to try to solve this question. But I am stuck with the $\epsilon$ thing.
Guess 2: Is it true that if a function's Fourier series converges pointwise, then the series must converge (pointwise a.e.) to the original function? If yes, then we can say that the Fourier series of $f$ converges pointwise to $g$, and $g$ is equal to $f\ a.e.$ by the above guess.

The hypothesis $\sum |\widehat{f}(n)|<\infty$ implies $\sum |\widehat{f}(n)|^2<\infty$, and we can think in terms of the Parseval theorem that $\int_0^{2\pi}|f(t)|^2\,dt=\sum |\widehat{f}(n)|^2$ (up to a normalizing constant).
Applying this to $f-g$ gives $\int_0^{2\pi}|f(t)-g(t)|^2\,dt=0$. From definitional properties of integrals, this entails that $f-g$ is $0$ almost everywhere.
