If a Hadamard gate is applied to a qubit that is in the state $|0\rangle$, then it becomes the state $$|+\rangle = \frac{1}{\sqrt{2}}\left(|0\rangle+|1\rangle\right)$$ In density matrix form, this state is:
$$\rho=|+\rangle\langle+|=\frac{1}{2}\left(|0\rangle+|1\rangle\right)\left(\langle0|+\langle1|\right)$$
But, if we start with the state $|0\rangle$ in density matrix form, $|0\rangle\langle0|$, and then apply a Hadamard gate, we get:
$$\rho=|+\rangle\langle0|=\frac{1}{\sqrt{2}}\left(|0\rangle+|1\rangle\right)\langle0|$$
Why is there a discrepancy between these two results? Which is correct?