Skip to content

Commit ee2dc35

Browse files
committed
ci(regen): derive rustfmt edition from Cargo.toml
1 parent 3a84ea0 commit ee2dc35

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

.github/workflows/regenerate.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,13 @@ jobs:
9898
# ergonomic layer is left to its own formatting (and is ignore-protected
9999
# from the generator anyway).
100100
- name: Format generated code
101-
run: find src/apis src/models -name '*.rs' -print0 | xargs -0 rustfmt --edition 2021
101+
run: |
102+
# Derive the edition from Cargo.toml so it can't drift from the crate
103+
# if the edition is ever bumped (same source as the version bump above).
104+
edition=$(cargo metadata --no-deps --format-version 1 \
105+
| jq -r '.packages[] | select(.name=="hotdata") | .edition')
106+
find src/apis src/models -name '*.rs' -print0 \
107+
| xargs -0 rustfmt --edition "$edition"
102108
103109
- name: Clean up fetched spec
104110
run: rm -f openapi.yaml

0 commit comments

Comments
 (0)