File tree Expand file tree Collapse file tree 2 files changed +26
-5
lines changed
Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Original file line number Diff line number Diff line change 88 branch_name :
99 description : ' Name of the feature branch on the forked repo'
1010 required : true
11+ edition :
12+ description : ' Which rust `edition` to use when parsing code'
13+ required : true
14+ type : choice
15+ options :
16+ - ' 2015'
17+ - ' 2018'
18+ - ' 2021'
19+ - ' 2024'
20+ default : ' 2015'
21+ style_edition :
22+ description : ' Which rustfmt `style_edition` to use when formatting'
23+ required : true
24+ type : choice
25+ options :
26+ - ' 2021' # 2015, 2018, and 2021 are all the same for `style_edition`
27+ - ' 2024'
28+ default : ' 2021'
1129 commit_hash :
1230 description : ' Optional commit hash from the feature branch'
1331 required : false
3048 rustup target add x86_64-unknown-linux-gnu
3149
3250 - name : check diff
33- run : bash ${GITHUB_WORKSPACE}/ci/check_diff.sh ${{ github.event.inputs.clone_url }} ${{ github.event.inputs.branch_name }} ${{ github.event.inputs.commit_hash || github.event.inputs.branch_name }} ${{ github.event.inputs.rustfmt_configs }}
51+ run : bash ${GITHUB_WORKSPACE}/ci/check_diff.sh ${{ github.event.inputs.clone_url }} ${{ github.event.inputs.branch_name }} ${{ github.event.inputs.edition }} ${{ github.event.inputs.style_edition }} ${{ github.event.inputs. commit_hash || github.event.inputs.branch_name }} ${{ github.event.inputs.rustfmt_configs }}
Original file line number Diff line number Diff line change 33set -e
44
55function print_usage() {
6- echo " usage check_diff REMOTE_REPO FEATURE_BRANCH [COMMIT_HASH] [OPTIONAL_RUSTFMT_CONFIGS]"
6+ echo " usage check_diff REMOTE_REPO FEATURE_BRANCH EDITION STYLE_EDITION [COMMIT_HASH] [OPTIONAL_RUSTFMT_CONFIGS]"
77}
88
99if [ $# -le 1 ]; then
1313
1414REMOTE_REPO=$1
1515FEATURE_BRANCH=$2
16- OPTIONAL_COMMIT_HASH=$3
17- OPTIONAL_RUSTFMT_CONFIGS=$4
16+ EDITION=${3:- 2015}
17+ STYLE_EDITION=${4:- 2021}
18+ OPTIONAL_COMMIT_HASH=$5
19+ OPTIONAL_RUSTFMT_CONFIGS=$6
1820
1921# OUTPUT array used to collect all the status of running diffs on various repos
2022STATUSES=()
@@ -55,7 +57,7 @@ function create_diff() {
5557
5658 for i in ` find . | grep " \.rs$" `
5759 do
58- $1 --unstable-features --skip-children --check --color=always $config $i >> $2 2> /dev/null
60+ $1 --edition= $EDITION --style-edition $STYLE_EDITION -- unstable-features --skip-children --check --color=always $config $i >> $2 2> /dev/null
5961 done
6062}
6163
@@ -189,6 +191,7 @@ function main() {
189191 echo Created tmp_dir $tmp_dir
190192
191193 compile_rustfmt $tmp_dir
194+ echo Parsing code with rust edition $EDITION and formatting code with style_edition $STYLE_EDITION
192195
193196 # run checks
194197 check_repo " https://github.com/rust-lang/rust.git" rust-lang-rust
You can’t perform that action at this time.
0 commit comments