Inference on the maximal rank of time-varying covariance matrices using high-frequency data