Skip to content

Commit 6fcc1d8

Browse files
committed
clippy: add cargo gpu check
1 parent bdcac36 commit 6fcc1d8

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-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: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ pub enum Command {
104104
/// Compile a shader crate to SPIR-V.
105105
Build(Box<Build>),
106106

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

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

0 commit comments

Comments
 (0)