Skip to content

Commit d2f1cc1

Browse files
committed
Move clippy lint configuration from CI to Cargo.toml
Adds [workspace.lints.clippy] to rust/Cargo.toml and has each crate inherit these lints via [lints] workspace = true. This ensures local clippy runs match CI behavior.
1 parent 2229c2f commit d2f1cc1

7 files changed

Lines changed: 31 additions & 12 deletions

File tree

.github/workflows/rust.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ jobs:
4848
4949
- name: Build Rust workspace
5050
working-directory: rust
51-
run: cargo build --workspace
51+
# Exclude spirv-tools-ffi which requires C++ build (tested in rust-ffi-tests job)
52+
run: cargo build --workspace --exclude spirv-tools-ffi
5253

5354
- name: Run Rust tests
5455
working-directory: rust
55-
run: cargo test --workspace
56+
# Exclude spirv-tools-ffi which requires C++ build (tested in rust-ffi-tests job)
57+
run: cargo test --workspace --exclude spirv-tools-ffi
5658

5759
# Rust FFI pretending to be C++ - runs C++ test suite against Rust implementation
5860
rust-ffi-tests:
@@ -154,13 +156,6 @@ jobs:
154156

155157
- name: Run Clippy
156158
working-directory: rust
157-
# Allow some lints that would require significant refactoring
158-
run: |
159-
cargo clippy --workspace --all-targets -- \
160-
-D warnings \
161-
-A clippy::result_large_err \
162-
-A clippy::too_many_arguments \
163-
-A clippy::type_complexity \
164-
-A clippy::collapsible_if \
165-
-A clippy::manual_is_multiple_of \
166-
-A clippy::derivable_impls
159+
# Exclude spirv-tools-ffi which requires C++ build (tested in rust-ffi-tests job)
160+
# Lint configuration is in rust/Cargo.toml [workspace.lints.clippy]
161+
run: cargo clippy --workspace --exclude spirv-tools-ffi --all-targets -- -D warnings

rust/Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ members = [
88
]
99
resolver = "2"
1010

11+
[workspace.lints.clippy]
12+
# Allow some lints that would require significant refactoring
13+
result_large_err = "allow"
14+
too_many_arguments = "allow"
15+
type_complexity = "allow"
16+
collapsible_if = "allow"
17+
manual_is_multiple_of = "allow"
18+
derivable_impls = "allow"
19+
1120
[patch.crates-io]
1221
rspirv = { git = "https://github.com/gfx-rs/rspirv", branch = "sdk-update" }
1322
spirv = { git = "https://github.com/gfx-rs/rspirv", branch = "sdk-update", package = "spirv" }

rust/spirv-tools-cli/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ path = "src/bin/spirv-objdump.rs"
4242
[[bin]]
4343
name = "spirv-size"
4444
path = "src/bin/spirv-size.rs"
45+
46+
[lints]
47+
workspace = true

rust/spirv-tools-core/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ serde = { version = "1.0", features = ["derive"] }
1919
serde_json = "1.0"
2020
spirv = { version = "0.3.0", default-features = false }
2121
heck = "0.4"
22+
23+
[lints]
24+
workspace = true

rust/spirv-tools-ffi/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ spirv-tools-cli = { path = "../spirv-tools-cli" }
2626

2727
[build-dependencies]
2828
cxx-build = "1"
29+
30+
[lints]
31+
workspace = true

rust/spirv-tools-opt/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ clap = { version = "4.5", features = ["derive"] }
1616
[dev-dependencies]
1717
pretty_assertions = "1.4"
1818
tempfile = "3.10"
19+
20+
[lints]
21+
workspace = true

rust/spirv-tools/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ default = []
1717
# for compatibility with crates that depend on spirv-tools with these features.
1818
use-compiled-tools = []
1919
use-installed-tools = []
20+
21+
[lints]
22+
workspace = true

0 commit comments

Comments
 (0)