  We revisit and extend the connections between $\mathbb{F}_{q^m}$-linear
rank-metric codes and evasive $\mathbb{F}_q$-subspaces of $\mathbb{F}_{q^m}^k$.
We give a unifying framework in which we prove in an elementary way how the
parameters of a rank-metric code are related to special geometric properties of
the associated evasive subspace, with a particular focus on the generalized
rank weights. In this way, we can also provide alternative and very short
proofs of known results on scattered subspaces. We then use this simplified
point of view in order to get a geometric characterization of near MRD codes
and a clear bound on their maximal length. Finally we connect the theory of
quasi-MRD codes with $h$-scattered subspaces of maximum dimension, extending to
all the parameters sets the already known results on MRD codes.
