@@ -263,6 +263,43 @@ jobs:
263
263
264
264
- run : cargo clippy --all-features -- -D warnings
265
265
266
+ lint-rust :
267
+ runs-on : ubuntu-latest
268
+ needs : changes
269
+ if : ${{ needs.changes.outputs.rust == 'true' }}
270
+
271
+ steps :
272
+ - name : Checkout repository
273
+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
274
+
275
+ - name : Install Rust
276
+ uses : dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # master
277
+ with :
278
+ toolchain : ${{ env.RUST_VERSION }}
279
+ - uses : Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
280
+
281
+ - name : Setup Poetry
282
+ uses : matrix-org/setup-python-poetry@5bbf6603c5c930615ec8a29f1b5d7d258d905aa4 # v2.0.0
283
+ with :
284
+ # Install like a normal project from source with all optional dependencies
285
+ extras : all
286
+ install-project : " true"
287
+ poetry-version : " 2.1.1"
288
+
289
+ - name : Ensure `Cargo.lock` is up to date (no stray changes after install)
290
+ # The `::error::` syntax is using GitHub Actions' error annotations, see
291
+ # https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions
292
+ run : |
293
+ if git diff --quiet Cargo.lock; then
294
+ echo "Cargo.lock is up to date"
295
+ else
296
+ echo "::error::Cargo.lock has uncommitted changes after install. Please run 'poetry install --extras all' and commit the Cargo.lock changes."
297
+ git diff --exit-code Cargo.lock
298
+ exit 1
299
+ fi
300
+
301
+ # This job is split from `lint-rust` because it requires a nightly Rust toolchain
302
+ # for some of the unstable options we use in `.rustfmt.toml`.
266
303
lint-rustfmt :
267
304
runs-on : ubuntu-latest
268
305
needs : changes
@@ -274,7 +311,8 @@ jobs:
274
311
- name : Install Rust
275
312
uses : dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # master
276
313
with :
277
- # We use nightly so that it correctly groups together imports
314
+ # We use nightly so that we can use some unstable options that we use in
315
+ # `.rustfmt.toml`.
278
316
toolchain : nightly-2025-04-23
279
317
components : rustfmt
280
318
- uses : Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
@@ -309,6 +347,7 @@ jobs:
309
347
- check-lockfile
310
348
- lint-clippy
311
349
- lint-clippy-nightly
350
+ - lint-rust
312
351
- lint-rustfmt
313
352
- lint-readme
314
353
runs-on : ubuntu-latest
@@ -327,6 +366,7 @@ jobs:
327
366
lint-pydantic
328
367
lint-clippy
329
368
lint-clippy-nightly
369
+ lint-rust
330
370
lint-rustfmt
331
371
lint-readme
332
372
0 commit comments