In this paper, we investigate the rank-metric codes which are proposed by Delsarte and Gabidulin to be complementary dual codes. We point out the relationship between Delsarte complementary dual codes and Gabidulin complementary dual codes. In finite field $\mathbb{F}_{q}^{m}$, we construct two classes of Gabidulin LCD MRD codes by self-dual basis (or almost self-dual basis) of $\mathbb{F}_{q}^{m}$ over $\mathbb{F}_{q}$. Under a suitable condition, we determine a sufficient condition for Delsarte optimal anticodes to be LCD codes over $\mathbb{F}_{q}$.