Introduce required `language_edition` and `style_edition` inputs for Diff Check
So that when manually dispatching the Diff Check workflow, an explicit pair of {language edition, style edition} are specified.
- E.g. if language edition is not specified,
rustfmtwill default to Edition 2015 likerustc, which can cause a lot of parse errors in the current set of candidate projects used for comparingrustfmtbehaviors since they tend to be on Edition 2024. - Similarly, when style edition is not specified,
rustfmtcan pick a lower default style edition than the actual language edition, which can also lead to unexpected diff check outcomes.
Note that the language/style editions specified with language_edition/style_edition inputs can still be overridden by rustfmt_configs, but the intention is to make sure the language_edition/style_edition are always specified.
Context: https://github.com/rust-lang/rustfmt/pull/6681#issuecomment-3438539702
Separate --edition/--style-edition vs --config=edition=...,style_edition=...
See discussion in #t-rustfmt > style edition flag vs config.
In this PR I use the --config=style_edition=$STYLE_EDITION form, because I'm not actually sure what's the precedence order of mixed invocations (example below), so I just used --config=style_edition=$STYLE_EDITION where later style_editions specified in optional rustfmt_configs should take precedence over this input.
$ rustfmt --style-edition=2024 --config=style_edition=2021
$ rustfmt --config=style_edition=2021 --style-edition=2024
Review remarks
The first commit in this PR is a drive-by fix for rusfmt -> rustfmt that was bothering me, should not contain any functional changes.
The following commits are the actual script/workflow changes.
Just want to note that rustfmt defaults to using edition=2015 if it's not explicitly specified in the rustfmt.toml so it might also be useful to add an --edition argument as well so we can more easily control how code is parsed because certain syntax doesn't parse using the default edition.
Hm, good point. I'll also make that explicit.
Updated the PR to also make language edition explicit. Also rebased since #6741 merged.
Fixed comment, no other changes.