Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.

Commit 371123d

Browse files
committed
clippy: add cargo gpu check
1 parent 4d5aa6d commit 371123d

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

crates/cargo-gpu/src/config.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ impl Config {
3131
) -> anyhow::Result<crate::build::Build> {
3232
let mut config = metadata.as_json(shader_crate_path)?;
3333

34-
env_args.retain(|arg| !(arg == "build" || arg == "install" || arg == "clippy"));
34+
env_args.retain(|arg| {
35+
!(arg == "build" || arg == "install" || arg == "check" || arg == "clippy")
36+
});
3537
let cli_args_json = Self::cli_args_to_json(env_args)?;
3638
Self::json_merge(&mut config, cli_args_json, None)?;
3739

crates/cargo-gpu/src/lib.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ pub enum Command {
105105
/// Compile a shader crate to SPIR-V.
106106
Build(Box<Build>),
107107

108+
/// Run `cargo check` on the shader crate with a SPIR-V target without building the actual shaders
109+
Check(Box<Build>),
110+
108111
/// Run clippy on a shader crate with a SPIR-V target
109112
Clippy(Box<Build>),
110113

@@ -143,16 +146,24 @@ impl Command {
143146
);
144147
command.install.run()?;
145148
}
146-
Self::Build(build) | Self::Clippy(build) => {
149+
Self::Build(build) | Self::Check(build) | Self::Clippy(build) => {
147150
let shader_crate_path = &build.install.shader_crate;
148151
let mut command = config::Config::clap_command_with_cargo_config(
149152
shader_crate_path,
150153
env_args,
151154
metadata_cache,
152155
)?;
153-
if let Self::Clippy(_) = self {
154-
command.build.spirv_builder.cargo_cmd = Some("clippy".into());
155-
command.build.allow_no_artifacts = true;
156+
#[expect(clippy::wildcard_enum_match_arm, reason = "unreachable")]
157+
match self {
158+
Self::Check(_) => {
159+
command.build.spirv_builder.cargo_cmd = Some("check".into());
160+
command.build.allow_no_artifacts = true;
161+
}
162+
Self::Clippy(_) => {
163+
command.build.spirv_builder.cargo_cmd = Some("clippy".into());
164+
command.build.allow_no_artifacts = true;
165+
}
166+
_ => {}
156167
}
157168
log::debug!("building with final merged arguments: {command:#?}");
158169

0 commit comments

Comments
 (0)