Closed
Description
As pointed out by @flip1995 in #3824 (comment), we currently don't have an easy way to run rustfmt
on the tests locally like we do on CI.
What we are doing on CI currently:
Line 24 in 8dfabdf
Line 26 in 8dfabdf
Lines 53 to 78 in 8dfabdf
It would be nice if we could extract that into a separate script so that people can use to format their tests locally, instead of waiting for CI.
Some things to consider when doing this:
- The script also needs to add the
rustfmt
component if it isn't present locally - We use
rustfmt
instead ofcargo fmt
for the test formatting because ofcargo fmt
doesn't format files in sub-directories intests
rustfmt#1820 - To make it idempotent, the new script should automatically detect the 'current' toolchain and switch back to it after the formatting script has finished (instead of switching to
master
) - Unlike a fresh VM on CI, We can't just use
rustup override set nightly
, because that doesn't update the locally installed nightly rust. We should probably pin to a specific nightly instead and update the version from time to time. - Using a shell script will not work cross-platform but I think doing it in Rust might be too much work?