Rollup merge of #82809 - notriddle:microoptimize-main-js, r=GuillaumeGomez
Rollup merge of #82809 - notriddle:microoptimize-main-js, r=GuillaumeGomez

rustdoc: Use substrings instead of split to grab enum variant paths

Both versions are about equally readable, but this version avoids scanning the entire path and building an intermediate array (`split()` in Rust is a lazy iterator, but not in JavaScript).

aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust