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

Commit 89f0341

Browse files
committed
clippy: add cargo gpu check
1 parent 4d5aa6d commit 89f0341

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

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: 14 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,23 @@ 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+
match self {
157+
Command::Check(_) => {
158+
command.build.spirv_builder.cargo_cmd = Some("check".into());
159+
command.build.allow_no_artifacts = true;
160+
}
161+
Command::Clippy(_) => {
162+
command.build.spirv_builder.cargo_cmd = Some("clippy".into());
163+
command.build.allow_no_artifacts = true;
164+
}
165+
_ => {}
156166
}
157167
log::debug!("building with final merged arguments: {command:#?}");
158168

0 commit comments

Comments
 (0)