Remove legacy_modes
auto merge of #6643 : sanxiyn/rust/legacy-modes, r=bstrie